Jump to content

gunsmokingman

Super Moderator
  • Posts

    2,296
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Canada

Everything posted by gunsmokingman

  1. Here is a HTA that uses VBS script to create Demo Timer Here is the code for the HTA <!-- Script By Gunsmokingman Aka Jake1eye --> <TITLE>Demo Timer</TITLE> <HTA:APPLICATION ID="Demo Timer" SCROLL="No" SCROLLFLAT ="No" SingleInstance="Yes" ShowInTaskbar="No" SysMenu="No" MaximizeButton="No" MinimizeButton="No" Border="Thin" BORDERSTYLE ="complex" INNERBORDER ="No" Caption="Yes" WindowState="Normal" APPLICATIONNAME="DTimer" Icon="%SystemRoot%\explorer.exe"> <STYLE type="text/css"> Body { Padding-Top:1pt;Padding-Bottom:1pt;Margin:1pt; Font-Size:10.25pt;Font-Weight:Bold; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; Color:Black;BackGround-Color:#EFE9E3; Text-Align:Center;Vertical-Align:Top; } DIV { Font-Size:10.25pt;Font-Weight:Bold;Color:#00A1A1; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; } TD { Font-Size:10.25pt;Font-Weight:Bold;Color:#515151; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; } BUTTON { Height:15pt;width:51pt;Cursor:Hand; Font:8.25pt;Font-weight:bold; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; Color:#404040;Text-Align:Center;Vertical-Align:Middle; filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#E5E5E5',EndColorStr='#7D7D7D'); Margin:1;Padding:2; Border-Left: 1px Transparent;Border-Right: 2px Transparent; Border-Top: 1px Transparent;Border-Bottom: 2px Transparent; } </STYLE> <SCRIPT LANGUAGE='VBScript'> '-> Resize And Place In Approx Center Of Screen Dim Wth, Hht :Wth = int(327) :Hht = int(150) window.ResizeTo Wth, Hht MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2)) Dim C1, H1, M1, T1, Tm1, txt Function Window_OnLoad() C1=0 :H1=0 :M1=0 Counter() End Function '-> To Keeps The Script In An Infinte Loop Until User Interaction Function Counter() '-> Reset The Seconds And Minutes Every 60 Cycles If C1 = 60 Then :M1 = M1 + 1 :C1 = 0 If M1 = 60 Then :H1 = H1 + 1 :M1 = 0 '-> To Display 02 Digits Ex 1 = 01 If Len(C1) = 1 Then C1 = "0" & C1 If Len(M1) = 1 Then M1 = "0" & M1 If Len(H1) = 1 Then H1 = "0" & H1 T1 = Split(Time(),":") If Len(T1(0)) = 1 Then T1(0) = "0" & T1(0) If Len(T1(1)) = 1 Then T1(1) = "0" & T1(1) Tx1.style.color="#9A0000" :Tx1.innerHTML=H1 Tx2.style.color="#009a00" :Tx2.innerHTML=M1 Tx3.style.color="#00009a" :Tx3.innerHTML=C1 Dim S :S = Split(T1(2), " ") If Len(S(0)) = 1 Then S(0) = "0" & S(0) Tx4.style.color="#009595" Tx4.innerHTML=T1(0) & ":" & T1(1) & ":" & S(0) & " " & S(1) C1 = C1 + 1 Tm1=window.setTimeout("Counter()",1000,"VBScript") End Function </SCRIPT> <BODY Scroll='No'><TABLE>Demo Timer</TABLE> <TABLE> <TD><TD>Hours&#160;&#187;</TD><TD><DIV ID='Tx1'>00 </DIV></TD></TD> <TD><TD>Minutes&#160;&#187;</TD><TD><DIV ID='Tx2'>00</DIV></TD></TD> <TD><TD>Seconds&#160;&#187;</TD><TD><DIV ID='Tx3'>00</DIV></TD></TD> </TABLE> <TABLE> <BUTTON ID='Bn1' OnClick="window.clearTimeout(Tm1)">Stop</BUTTON> <BUTTON ID='Bn2' OnClick="Counter()">Re-Start</BUTTON> <BUTTON ID='Bn3' OnClick="window.clearTimeout(Tm1): Window_OnLoad()">Re-Set</BUTTON> <BUTTON ID='Bn4' OnClick="window.clearTimeout(Tm1): window.close()">Close</BUTTON> </TABLE> <TABLE> <TD><DIV ID='Tx4'>00:00 PM</DIV></TD> </TABLE> </BODY> Demo_TimerCount.zip
  2. Here are some links for you to try and work out what you need done 1:\ Reading From and Writing to the Local Registry 2:\Changing Registry Data 3:\How Can I Create a New Registry Key
  3. You can use a VBS script to not show any windows Example '-> Constants For The Various Window States Const Hide = 0, Norm = 1, Min = 2, Max =3 '-> Object For Runtime Dim Act :Set Act = CreateObject("Wscript.Shell") '-> Hidden Window And No Wait For The Script Act.Run("%comspec% /C @Echo Off && CLS && Echo. && Echo Test && ping -n 3 127.0.0.1>nul"),0,False '-> Show The Normal Window And Wait For The Script To Finish ' Act.Run("%comspec% /C @Echo Off && CLS && Echo. && Echo Test && ping -n 3 127.0.0.1>nul"),1,True
  4. Here is the results with 2 usb drives plug in to my computer, remove the .txt to make active. UsbDrive.vbs.txt
  5. Here is a simple VBS script that list Removable drives if they are connected. It will display the Drive Size, Free Space, Used Spaced. '-> Constant For GB Size Const GB = 1073741824 '-> Object For Runtime Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") '-> Varibles For Run Time Dim Drv, Dsk, Usb, vB :vB = vbTab '-> Loop Threw All Drives For Each Dsk In Fso.Drives If Dsk.IsReady Then '-> Drive Type Removable Or USB If Dsk.DriveType = 1 Then Usb = Usb &_ Dsk.DriveLetter & ":\ USB" & vB & "Size = " & Num(Dsk.TotalSize) & ", Free = " &_ Num(Dsk.FreeSpace) & ", Used = " & Num(Dsk.TotalSize - Dsk.FreeSpace) & vbCrLf End If End If Next '-> Function To Convert Numbers To GB Function Num(N) Num = Round(N/GB,2) If Num <= 10 Then Num = "0" & Num If Num > 0 And Num < 1 Then Num = "0" & Num End Function '-> Show The Results If Chk = True Then MsgBox vbTab & "Usb Drive Results" & vbCrLf & Usb, 4128,"Usb Querry" Else MsgBox "No Removable Drives Were Found",4128,"Usb Querry" End If
  6. Here is the VBS way of doing it with checks '-> Runtime Varibles Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") '-> Runtime Object Dim C1, C2, Tx1, Tx2,Ts '-> Check For Text File One If Fso.FileExists("Test1.txt") Then C1 = True Set Ts = Fso.OpenTextFile("Test1.txt") Tx1 = Ts.ReadAll Ts.Close End If '-> Check For Text File Two If Fso.FileExists("Test2.txt") Then C2 = True Set Ts = Fso.OpenTextFile("Test2.txt") Tx2 = Ts.ReadAll Ts.Close End If '-> If C1 And C2 Are true Than Make The Third Text File If C1 = True And C2 = True Then Set Ts = Fso.CreateTextFile("Test3.txt") Ts.WriteLine Tx1 & vbCrLf & Tx2 Ts.Close CreateObject("Wscript.Shell").run("Test3.txt") End If
  7. Perhaps a VBS script would be better suited to your needs, here is an example of looping threw all the non empty drives. '-> Object For RuntimeDim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> Varibles For Run TimeDim Drv, Dsk'-> Loop Threw All Drives For Each Dsk In Fso.Drives If Dsk.IsReady Then'-> Drive Type Select Case Dsk.DriveType Case 0: Drv = "Unknown" Case 1: Drv = "Removable" Case 2: Drv = "Fixed" Case 3: Drv = "Network" Case 4: Drv = "CD-ROM" Case 5: Drv = "RAM Disk" End select WScript.Echo Dsk.DriveLetter & ":\ " & Drv End If Next
  8. Here is a new WMI Query that I hope is more to what you need. '-> WMI ObjectDim Wmi :Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")'-> Run Time VariblesDim Obj, Rpt'-> Wmi Query And Class Loop For Each Obj in Wmi.ExecQuery("SELECT * FROM Win32_DiskDrive")'-> Collect The Objects For The Wmi report Rpt = Rpt & "-----------------------------------" & vbCrLf & _ "Interface" &vbtab& Obj.InterfaceType & vbCrLf & _ "Model " &vbtab& Obj.Model & vbCrLf & _ "Name " & vbtab& Obj.Name & vbCrLf Next'-> Report The WMI Query MsgBox Space(10) & "WMI Disk Drive Report" & vbCrLf & Rpt,4120,"Result WMI"
  9. I believe in earlier versions of Wscript you needed to close the object created by using Obj = Nothing, but in newer version it is not needed.
  10. The reason I have not help is because it a WSH and using VBScript as the working engine. Plus there examples as to how the script should be used. Example of usage from the script. <example>fw-ip-search.wsf /search:"%136.165.238.%"</example><example>fw-ip-search.wsf /run:internet /search:"%136.165.238.%"</example><example>fw-dst_host-search.wsf/search:"%dmp-ll02-1%"</example><example>fw-dst_host-search.wsf/run:internet / search:"%dmp-ll02-1%"</example>
  11. If you really need a Custom Date for your batch, try this batch @Echo OffCLSMODE 75, 15COLOR F2TITLE Passing VBS Date To CmdSet Vbs=Test.vbs::Create VBS File With Date InformationEcho Dim Fso :Set Fso = Createobject("Scripting.FileSystemObject") > %Vbs%Echo Dim D, M, Y, Ts =Day(Date) :M=Month(Date) :Y=Year(Date) >> %Vbs%Echo Set Ts = Fso.CreateTextFile("Temp.cmd") >> %Vbs%Echo If Len(M) = 1 Then M = "0" ^& M >> %Vbs%Echo If Len(D) = 1 Then D = "0" ^& D >> %Vbs%Echo Ts.WriteLine "Set MyDate=" ^& Y ^& "/" ^& M ^& "/" ^& D >> %Vbs%Echo Ts.Close >> %Vbs%Call %Vbs%Call Temp.cmdDel %Vbs%Del Temp.cmdEcho.Echo Custom Date : %MyDate%Pause
  12. I made this Demo Splash Screen HTA which uses 2 timers and changes display text then self closes after 8 seconds. Demo_SplashScreen.hta <TITLE>Splash Screen</TITLE><HTA:APPLICATION ID='DemoSplash' Scroll='No' SCROLLFLAT ='No' SingleInstance='Yes' SysMenu='No' ShowInTaskBar='No' MaximizeButton='No' MinimizeButton='nO' Border='Thick' BORDERSTYLE ='complex' INNERBORDER ='Yes' Caption='No' WindowState='Normal' APPLICATIONNAME='DSplash' Icon='%SystemRoot%\explorer.exe'><STYLE Type="text/css"> Body{ BackGround-Color:#EFE9E3;Text-Align:Center;Vertical-Align:Top; Font-Size:10.05pt;Font-Weight:Bold;Color:#001254; Font-Family:Lucida Console;Arial,Tahoma,Comic Sans MS,Segoe Ui; Margin-Top:2;Margin-Bottom:2;Margin-Left:4;Margin-Right:4; Padding-Top:1;Padding-Bottom:1;Padding-Left:4;Padding-Right:4; Border-Top:2px Solid #a6a29e;Border-Bottom:3px Solid #cbc7c3; Border-Left:2px Solid #b2aeaa;Border-Right:3px Solid #bcb8b4; } DIV{Color:#015501;Padding-Top:1;Padding-Bottom:1:} .txt{width:99%; Font-Size:8.05pt;Font-Weight:Bold;Color:#004511;Font-Family:Segoe Ui; Padding-Top:2;Padding-Bottom:2;Text-Align:Left; }</STYLE><SCRIPT LANGUAGE="VBScript">'-> Resize And Move Window Dim Wth :Wth = int(425) Dim Hht :Hht = int(175) window.ResizeTo Wth, Hht MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))'-> Run Time Varibles Dim C1, Tm1'-> OnLoad Function Display Test Function Window_onLoad() Tx1.innerHTML = "Splash Screen Display Text To Show The User. Some More Text For " & _ "The User To Read. This Window Will Self Close" Tm1=window.setTimeout("StopTime()",5000,"VBScript") End Function'-> Clear The Timer And Change Message Function StopTime() window.clearTimeout(Tm1) Tx1.innerHTML = "Preparing To Close This Window, Script Completed" Tm1=window.setTimeout("TheEnd()",3000,"VBScript") End Function'-> Clear The Timer And Close Window Function TheEnd() window.clearTimeout(Tm1) window.close() End Function</SCRIPT><BODY> <DIV>Demo Splash Screen</DIV><HR><DIV ID='Tx1' Class='txt'> </DIV></BODY>Demo_SplashScreen.zip
  13. You can not do what you want with an image and VBS However here is a work around this is a HTA that you could add a image to it. The HTA will close after the VBS script is executed. SplashScreen.hta <TITLE>Splash Screen</TITLE><HTA:APPLICATION ID='SplashScreen' Scroll='No' SCROLLFLAT ='No' SingleInstance='Yes' SysMenu='No' ShowInTaskBar='No' MaximizeButton='No' MinimizeButton='nO' Border='Thick' BORDERSTYLE ='complex' INNERBORDER ='Yes' Caption='No' WindowState='Normal' APPLICATIONNAME='Splash' Icon='%SystemRoot%\explorer.exe'><STYLE Type="text/css"> Body{ BackGround-Color:#00a4a4;Text-Align:Center;Vertical-Align:Top; Font-Size:10.05pt;Font-Weight:Bold;Color:#001254; Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui; Margin-Top:1;Margin-Bottom:1;Margin-Left:4;Margin-Right:4; Padding-Top:1;Padding-Bottom:1;Padding-Left:4;Padding-Right:4; Border-Top:2px Solid #a6a29e;Border-Bottom:3px Solid #cbc7c3; Border-Left:2px Solid #b2aeaa;Border-Right:3px Solid #bcb8b4; }</STYLE><SCRIPT LANGUAGE="VBScript">'-> Resize And Move Window Dim Wth :Wth = int(325) Dim Hht :Hht = int(125) window.ResizeTo Wth, Hht MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))'-> Window Onload And Execute The Code Then Close Window Function Window_onLoad() Set Sapi = CreateObject("SAPI.SpVoice") If hour(time) < 12 Then Sapi.speak "Good Morning yugioh47 " If hour(time) > 12 And hour(time) < 16 Then Sapi.speak "Good afternoon yugioh47" if hour(time) > 16 Then Sapi.speak "Good evening yugioh47" window.close() End Function</SCRIPT><BODY>Splash Screen</BODY>SplashScreen.zip
  14. Here are some tips to help you 1:\ VBS does not need to Dim A :Set A = Something, but it consider good coding practice to Dim all variable's. This is to help you get used to declaring a variable in more advance programing languages. Example of a more complex scripting language listing all the files in the parent directory. MS Jscript var Fso = new ActiveXObject("Scripting.FileSystemObject")var Itm/* Try File As New Collection Using Fso.GetFolder(".").Files */ try{ var File = new Enumerator(Fso.GetFolder(".").files); for (; !File.atEnd(); File.moveNext()){ /* Collect The Items */ var i = File.item();Itm +="\r\n File Name : "+i.Name;} }catch(e){WScript.Echo(" Error Occur "+e.description);} /* Show All The Items And Replace The Word Undefined*/ WScript.Echo(Itm.replace("undefined",""))2:\ Learn to use Array and For Each Loop. If you where to add 2 more font types, you would have to add 2 more lines of code. With an Array and an For Each Loop, you would only add 2 items to the Array. Try this untested VBS Const FONTS = &H14&Dim Dic :Set Dic = CreateObject("Scripting.Dictionary")Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim Shl :Set Shl = CreateObject("Shell.Application")Dim Fns :Set Fns = Shl.Namespace(FONTS)Dim i,v :v = Array("fon","otf","pfm", "ttf") For Each i In v Dic.CompareMode = 1 'Make lookups case-insensitive. Dic.Add i, True Next For Each i In Fso.getfolder(".").Files If Dic.Exists(Fso.GetExtensionName(i)) Then Fns.CopyHere i.Path End If Next
  15. I only worry about things in English, you can figure out any other problems. You never mention any recursive threw sub folders. I am not here to do your job, I just provided scripts that the user request, I don't fix all the problems.
  16. This one filter out the file type Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim i'-> Start Folder Where Script Is Located And List All Files For Each i In Fso.GetFolder(".").Files '-> Filter Out The Files If i.Type = "TrueType font file" Then FontCopy(i.Path) End If Next '-> Copy The File To The Font Folder Function FontCopy(F) Const FONTS = &H14& Dim Shl :Set Shl = CreateObject("Shell.Application") Dim Obj :Set Obj = Shl.Namespace(FONTS) Obj.CopyHere F End Function
  17. You might want to try this script it uses 2 for each loops and only one If end if. Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> Array To Hold The File TypeDim i, j, v: v = Array("fon","otf","pfm","ttf")'-> Start Folder Where Script Is Located And List All Files For Each i In Fso.GetFolder(".").Files For Each j In v '-> Filter Out The Files Type From Array v If LCase(Right(i.Name,3)) = j Then FontCopy(i.Path) End If Next Next '-> Copy The File To The Font Folder Function FontCopy(F) Const FONTS = &H14& Dim Shl :Set Shl = CreateObject("Shell.Application") Dim Obj :Set Obj = Shl.Namespace(FONTS) Obj.CopyHere F End Function
  18. I have only tested the filter and not the copy function. You will have to edit this to suit your needs. Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> Start Folder Where Script Is Located And List All Files For Each i In Fso.GetFolder(".").Files '-> Filter Out The Files Change To Suit Your Needs If LCase(Right(i.Name,3)) = "vbs" Then FontCopy(i.Path) End If If LCase(Right(i.Name,3)) = "txt" Then FontCopy(i.Path) End If Next '-> Copy The File To The Font Folder Function FontCopy(F) Const FONTS = &H14 Dim Shl :Set Shl = CreateObject("Shell.Application") Dim Obj :Set Obj = Shl.Namespace(FONTS) Obj.CopyHere F End Function
  19. Try this VBS script that produces a HTA with a list of Missing and Install Updates, it tries to make a download link from Microsoft site. kbList.vbs Option Explicit'-> Makes ShorterDim Vb :Vb = vbCrLf'-> Objects For Script Run TimeDim Act, Fso, CName Set Act = CreateObject("Wscript.Shell") Set Fso = CreateObject("Scripting.FileSystemObject") CName = Act.ExpandEnvironmentStrings("%ComputerName%")'-> Ask If You Want To Use Script Dim A1 :A1 = Act.Popup( _ " Would You Like To Run The Report Updates Script?" & Vb & _ "The Script Will Take Approx 5 Minutes To Be Done." & Vb & _ "If Nothing Is Selected This Will Self Close In 7" & Vb & _ "Seconds And Do Nothing", 7, "Search Updates",4132) If A1 = 7 Or A1 = -1 Then WScript.Quit(1) End If '-> Varibles For Hta OutputDim Hta :Hta = Act.SpecialFolders("Desktop") & "\" & CName & "_KbInfo.hta"Dim Ar :Ar = Chr(160) & Chr(187) & Chr(160)Dim Al :Al = Chr(160) & Chr(171) & Chr(160)Dim Ts'-> Search Objects And VariblesDim SearchResult, Update, UpDateSearcher,UpDateSession Set UpDateSession = CreateObject("Microsoft.Update.Session") Set UpDateSearcher = UpDateSession.CreateUpDateSearcher() Set SearchResult = UpDateSearcher.Search("Type='Software'")'-> Varibles For Count, Loop, Updates Dim C1, I, Kb_C, Kb_M, M1, V1, V2 :C1=0 :M1=0 '-> Loop To List Install And Missing Updates For I = 0 To SearchResult.Updates.Count-1 Set Update = SearchResult.Updates.Item(I) If Update.IsInstalled Then C1 = C1 + 1 : V1 = C1 Kb_C = Kb_C & C1 & "=-=" & Update.Title & "=-=" & Update.Description & Vb Else M1 = M1 + 1 : V2 = M1 Kb_M = Kb_M & M1 & "=-=" & Update.Title & "=-=" & Update.Description & Vb End If Next'-> If There Are No Missing Updates If M1 = 0 Then V2 = "000" Kb_M = "000=-=No Updates Found=-=There Was No Updates Missing" & Vb End If'-> If There Are No Installed Updates If C1 = 0 Then V1 = "000" Kb_C = "000=-=No Updates Found Installed=-=There Was No Updates Found Installed." & Vb End If'-> Build The Hta Report Set TS = Fso.CreateTextFile(Hta) TS.WriteLine "<TITLE>" & CName & "</TITLE>" & Vb & _ "<STYLE Type=""text/css"">" & Vb & _ " Body{Font-Size:9.25pt;Font-Weight:Bold;" & Vb & _ " Font-Family:Segoe Ui,Arial,Tahoma;" & Vb & _ " Color:#000063;BackGround-Color:#fdf7f1;" & Vb & _ " Margin-Top:5;Margin-Bottom:5;Margin-Left:4;Margin-Right:4;" & Vb & _ " Padding-Top:5;Padding-Bottom:5;Padding-Left:4;Padding-Right:4;" & Vb & _ " Text-Align:Left;Vertical-Align:Top;" & Vb & _ " Border-Top:2px Solid #cbc7c3;Border-Bottom:3px Solid #a6a29e;" & Vb & _ " Border-Left:2px Solid #bcb8b4;Border-Right:3px Solid #b2aeaa;}" & Vb & _ " TD.Tx1{Font-Size:8.25pt;Color:#004747;Font-Weight:Bold;Padding-Left:3;Width:70pt;}" & Vb & _ " TD.Tx2{Font-Size:8.25pt;Color:#006969;Font-Weight:Bold;Width:105pt;}" & Vb & _ " P.D1{Font-Size:8.25pt;Color:#1e1e1e;Width:99%;Padding-Left:1;Margin:1pt;}" & Vb & _ " FONT.F1{Font-Size:8.25pt;Color:#004400;Padding-Left:3;Width:17pt;}" & Vb & _ " FONT.F2{Font-Size:8.25pt;Font-Weight:Bold;Color:#000063;Padding-Left:3;}" & Vb & _ "</STYLE>" & Vb & _ "<SCRIPT LANGUAGE='JScript'>window.resizeTo (725,425), window.moveTo (210,175);</SCRIPT>" Ts.WriteLine "<BODY Link='#003535' vLink='#007575' aLink='#003535'>" & Vb & _ "<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Scan Date Time</TD><TD CLASS='Tx2'>" & _ Ar & Now & "</TD></TABLE>" & Vb & _ "<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Computer Name</TD><TD CLASS='Tx2'>" & _ Ar & CName & "</TD></TABLE>" & Vb & _ "<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Install KB</TD><TD CLASS='Tx2'>" & _ Ar & Adz(V1) & "</TD></TABLE>" & Vb & _ "<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Missing KB</TD><TD CLASS='Tx2'>" & _ Ar & Adz(V2) & "</TD></TABLE><HR Width=97%>" Ts.WriteLine "<TABLE Align='Center'>List Of Missing Updates</TABLE><HR Width=99%>" SortInfo(Kb_M) Ts.WriteLine "<TABLE Align='Center'>List Of Installed Updates</TABLE><HR Width=99%>" SortInfo(Kb_C) Ts.Close'-> Run The Hta Act.Run("mshta.exe " & Chr(34) & Hta & Chr(34)),1,True'/-> Keep Or Delete The Hta Report If MsgBox("Did You Want To Keep The HTA Update Report?" & Vb & _ "Yes To Keep The Hta, No To Delete The Hta.",4132,"Keep Or Delete") = 7 Then Fso.DeleteFile Hta, True End If'-> Function Sort The Info For Display In The Hta Function SortInfo(Arg) Dim Obj, S1, V For Each Obj In Split(Arg,Vb) If Not Obj = "" Then V = Split(Obj,"=-=") S1= Right(V(1),11) If InStr(S1,"(") Then S1 = Replace(S1,"(","") If InStr(S1,")") Then S1 = Replace(S1,")","") If InStr(S1,"-") Then S1 = Replace(S1,"-","") If InStr(S1," ") Then S1 = Replace(S1," ","")'-> Sort The Info For Links And None links If LCase(Left(S1,2)) = "kb" Then Ts.WriteLine "<FONT Class='F1'>" & Al & Adz(V(0)) & Ar & "</FONT>" & Vb & _ "<FONT Class='F2'>" & V(1) & "</FONT>" & Vb &_ "<P Class='D1'> " & V(2) & "</DIV>" & Vb & _ "<DIV ALIGN='CENTER'>" & Vb & _ "<A HREF='http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=" & _ S1 &"&DisplayLang='>" & S1 & " Information</A></DIV><HR Width=99%>" & Vb & Vb Else Ts.WriteLine "<FONT Class='F1'>" & Al & V(0) & Ar & "</FONT>" & Vb &_ "<FONT Class='F2'>" & V(1) & "</FONT>" & Vb &_ "<P Class='D1'> " & V(2) & "</DIV><HR Width=99%>" & Vb & Vb End If End If Next End Function '-> Add Zero To A Number Function Adz(N) If Len(N) = 1 Then N = "00" & N If Len(N) = 2 Then N = "0" & N Adz = N End FunctionRename KbList.vbs.txt to KbList.vbs to make activeKbList.vbs.txt
  20. The script uses the Microsoft update object and I have no idea on how it would work in VM environment.
  21. Here is a VBS script that build a HTA with a list of missing and installed updates. The HTA has links called KBNUMBER information that tries to open the download from Microsoft for the KBNUMBER KBList.vbs Option Explicit'-> Makes ShorterDim Vb :Vb = vbCrLf'-> Objects For Script Run TimeDim Act, Fso, CName Set Act = CreateObject("Wscript.Shell") Set Fso = CreateObject("Scripting.FileSystemObject") CName = Act.ExpandEnvironmentStrings("%ComputerName%")'-> Ask If You Want To Use Script Dim A1 :A1 = Act.Popup( _ " Would You Like To Run The Report Updates Script?" & Vb & _ "The Script Will Take Approx 5 Minutes To Be Done." & Vb & _ "If Nothing Is Selected This Will Self Close In 7" & Vb & _ "Seconds And Do Nothing", 7, "Search Updates",4132) If A1 = 7 Or A1 = -1 Then WScript.Quit(1) End If '-> Varibles For Hta OutputDim Hta :Hta = Act.SpecialFolders("Desktop") & "\" & CName & "_KbInfo.hta"Dim Ar :Ar = Chr(160) & Chr(187) & Chr(160)Dim Al :Al = Chr(160) & Chr(171) & Chr(160)Dim Ts'-> Search Objects And VariblesDim SearchResult, Update, UpDateSearcher,UpDateSession Set UpDateSession = CreateObject("Microsoft.Update.Session") Set UpDateSearcher = UpDateSession.CreateUpDateSearcher() Set SearchResult = UpDateSearcher.Search("Type='Software'")'-> Varibles For Count, Loop, Updates Dim C1, I, Kb_C, Kb_M, M1, V1, V2 :C1=0 :M1=0 '-> Loop To List Install And Missing Updates For I = 0 To SearchResult.Updates.Count-1 Set Update = SearchResult.Updates.Item(I) If Update.IsInstalled Then C1 = C1 + 1 : V1 = C1 Kb_C = Kb_C & C1 & "=-=" & Update.Title & "=-=" & Update.Description & Vb Else M1 = M1 + 1 : V2 = M1 Kb_M = Kb_M & M1 & "=-=" & Update.Title & "=-=" & Update.Description & Vb End If Next'-> If There Are No Missing Updates If M1 = 0 Then V2 = "000" Kb_M = "000=-=No Updates Found=-=There Was No Updates Missing" & Vb End If'-> If There Are No Installed Updates If C1 = 0 Then V1 = "000" Kb_C = "000=-=No Updates Found Installed=-=There Was No Updates Found Installed." & Vb End If'-> Build The Hta Report Set TS = Fso.CreateTextFile(Hta) TS.WriteLine "<TITLE>" & CName & "</TITLE>" & Vb & _ "<STYLE Type=""text/css"">" & Vb & _ " Body{Font-Size:9.25pt;Font-Weight:Bold;" & Vb & _ " Font-Family:Segoe Ui,Arial,Tahoma;" & Vb & _ " Color:#000063;BackGround-Color:#fdf7f1;" & Vb & _ " Margin-Top:5;Margin-Bottom:5;Margin-Left:4;Margin-Right:4;" & Vb & _ " Padding-Top:5;Padding-Bottom:5;Padding-Left:4;Padding-Right:4;" & Vb & _ " Text-Align:Left;Vertical-Align:Top;" & Vb & _ " Border-Top:2px Solid #cbc7c3;Border-Bottom:3px Solid #a6a29e;" & Vb & _ " Border-Left:2px Solid #bcb8b4;Border-Right:3px Solid #b2aeaa;}" & Vb & _ " TD.Tx1{Font-Size:8.25pt;Color:#004747;Font-Weight:Bold;Padding-Left:3;Width:70pt;}" & Vb & _ " TD.Tx2{Font-Size:8.25pt;Color:#006969;Font-Weight:Bold;Width:105pt;}" & Vb & _ " P.D1{Font-Size:8.25pt;Color:#1e1e1e;Width:99%;Padding-Left:1;Margin:1pt;}" & Vb & _ " FONT.F1{Font-Size:8.25pt;Color:#004400;Padding-Left:3;Width:17pt;}" & Vb & _ " FONT.F2{Font-Size:8.25pt;Font-Weight:Bold;Color:#000063;Padding-Left:3;}" & Vb & _ "</STYLE>" & Vb & _ "<SCRIPT LANGUAGE='JScript'>window.resizeTo (725,425), window.moveTo (210,175);</SCRIPT>" Ts.WriteLine "<BODY Link='#003535' vLink='#007575' aLink='#003535'>" & Vb & _ "<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Scan Date Time</TD><TD CLASS='Tx2'>" & _ Ar & Now & "</TD></TABLE>" & Vb & _ "<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Computer Name</TD><TD CLASS='Tx2'>" & _ Ar & CName & "</TD></TABLE>" & Vb & _ "<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Install KB</TD><TD CLASS='Tx2'>" & _ Ar & Adz(V1) & "</TD></TABLE>" & Vb & _ "<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Missing KB</TD><TD CLASS='Tx2'>" & _ Ar & Adz(V2) & "</TD></TABLE><HR Width=97%>" Ts.WriteLine "<TABLE Align='Center'>List Of Missing Updates</TABLE><HR Width=99%>" SortInfo(Kb_M) Ts.WriteLine "<TABLE Align='Center'>List Of Installed Updates</TABLE><HR Width=99%>" SortInfo(Kb_C) Ts.Close'-> Run The Hta Act.Run("mshta.exe " & Chr(34) & Hta & Chr(34)),1,True'/-> Keep Or Delete The Hta Report If MsgBox("Did You Want To Keep The HTA Update Report?" & Vb & _ "Yes To Keep The Hta, No To Delete The Hta.",4132,"Keep Or Delete") = 7 Then Fso.DeleteFile Hta, True End If'-> Function Sort The Info For Display In The Hta Function SortInfo(Arg) Dim Obj, S1, V For Each Obj In Split(Arg,Vb) If Not Obj = "" Then V = Split(Obj,"=-=") S1= Right(V(1),11) If InStr(S1,"(") Then S1 = Replace(S1,"(","") If InStr(S1,")") Then S1 = Replace(S1,")","") If InStr(S1,"-") Then S1 = Replace(S1,"-","") If InStr(S1," ") Then S1 = Replace(S1," ","")'-> Sort The Info For Links And None links If LCase(Left(S1,2)) = "kb" Then Ts.WriteLine "<FONT Class='F1'>" & Al & Adz(V(0)) & Ar & "</FONT>" & Vb & _ "<FONT Class='F2'>" & V(1) & "</FONT>" & Vb &_ "<P Class='D1'> " & V(2) & "</DIV>" & Vb & _ "<DIV ALIGN='CENTER'>" & Vb & _ "<A HREF='http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=" & _ S1 &"&DisplayLang='>" & S1 & " Information</A></DIV><HR Width=99%>" & Vb & Vb Else Ts.WriteLine "<FONT Class='F1'>" & Al & V(0) & Ar & "</FONT>" & Vb &_ "<FONT Class='F2'>" & V(1) & "</FONT>" & Vb &_ "<P Class='D1'> " & V(2) & "</DIV><HR Width=99%>" & Vb & Vb End If End If Next End Function '-> Add Zero To A Number Function Adz(N) If Len(N) = 1 Then N = "00" & N If Len(N) = 2 Then N = "0" & N Adz = N End FunctionRename KbList.vbs.txt to KbList.vbs make activeKbList.vbs.txt
×
×
  • Create New...