Blog

Author Archive

Simple Virus Cleaner

This is a little batch file that should aid in the cleanup of computers that have been locked out by malware.

Its a work in progress, so check back as this script evolves.
Please let us know if your experiences with this script as I will continue to work on it.

*** NOTE:
This will clean-out your start-up programs.
They will be backed up into a registry file so you can restore them later once the virus is removed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@echo off
echo Creating backup folder...
mkdir backups
 
echo Removing policy restrictions...
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableRegistryTools /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableRun /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v NoDispCPL /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v NoFolderOptions /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v DisallowRun /t REG_DWORD /d 0 /f
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run /f
 
echo Backing up Startup Applications...
reg export HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run "backups\HKCU Runs.reg"
reg export HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run "backups\HKLM Runs.reg"
 
echo Removing Startup Applications...
reg delete HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /f
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /f
 
reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /f
 
echo Removing RunOnce entries...
reg delete HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /f
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /f
reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /f
 
echo Showing Hidden Files...
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL /v CheckedValue /t REG_DWORD /d 1 /f
 
echo Repairing Explorer Shell...
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d Explorer.exe /f
reg delete "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\shell" /f
 
echo Repairing Safemode...
reg add HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot /v AlternateShell /t REG_SZ /d "cmd.exe" /f
 
echo Rebooting...
shutdown /f /r /t 00

Posted in: Scripts

Leave a Comment (0) →

Uncompress/Decompress Files

Decompress Files
Every now and then I come across a computer that someones compressed the files on the HDD.
This degrades the performance substantially and for what little space you actually get its not worth it.

Anyhow, with this command you can uncompress files over a drive.
It will take awhile but it gets the job done.

1
Compact /u /s /a /q /I *.*

Posted in: Scripts, Technical

Leave a Comment (0) →

Install Microsoft and Windows Updates

A lot of scripts out there only install windows updates, this one gets the lot.
I’ve found that there are a number of patches not included in the LanGuard patch management, so here’s a script to fill in the gaps.

This script is a modified version of the one found here – blogs.technet.com/b/chrad/archive/2009/07/13/dynamic-provisioning-with-vmm-proxy-windows-updates-and-scripts.aspx

Also just added the ability to skip updates.
So if you don’t want the bing bar or windows search or any other update, just put add the name to the array. (Should also work with Most KB Numbers)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
Const ssDefault = 0
 Const ssManagedServer = 1 
 Const ssOthers = 3 'Microsoft Updates
 Const ssWindowsUpdate = 2 'Windows Updates
 'Array of updates to skip. 
 SkipUpdates = Array("bing","windows live","windows search")
 '#############################
 ' Create Session
 '#############################
 Set UpdateSession = CreateObject("Microsoft.Update.Session")
 Set UpdateSearcher = UpdateSession.CreateUpdateSearcher()
 '#############################
 ' Register Microsoft Update
 '#############################
 RegisterMu
 updateSearcher.ServerSelection = ssOthers '<==== **** CHANGE THIS TO YOUR PREFERENCE ****
 updateSearcher.ServiceID = "7971f918-a847-4430-9279-4a52d1efe18d"
 '#############################
 ' Create List of Updates to Download
 '#############################
 Set UpdatesToDownload = CreateObject("Microsoft.Update.UpdateColl")
 '#############################
 ' Search for Updates
 '#############################
 Set SearchResult = UpdateSearcher.Search("Isinstalled=0")
 '#############################
 ' Quit if No Updates Found
 '#############################
 If SearchResult.Updates.Count = 0 Then
     WScript.Echo "No updates found."
 WScript.Quit
 End If
 Dim strSpacer
 For I = 0 To SearchResult.Updates.Count-1
     Set Update = SearchResult.Updates.Item(I)
 
     ' formatting helper
     If I < 10 Then
         strSpacer = " "
     Else
         strSpacer = ""
     End If
 
     'Check updates to skip
 bSkip = false
 For Each Name in SkipUpdates
 If Instr(LCase(update.Title), LCase(Name)) > 0 Then
 bSkip = True
 Exit For
 End if
 Next
 If bSkip = True Then
 WScript.Echo "Skipping update " & update.Title
 Else
 'WScript.Echo "[" & strSpacer & I & "]  Found Update, Marking For Download:  " & update.Title
 UpdatesToDownload.Add(Update)
 End if 
 
 Next
 '#############################
 ' Download Updates
 '#############################
 Set Downloader = UpdateSession.CreateUpdateDownloader()
 Downloader.Updates = UpdatesToDownload
 On Error Resume Next
 Downloader.Download()
 If Err.number <> 0 Then
     Wscript.Echo "An error occurred in  Downloader.Download() of updates"
     Wscript.Echo "Number: " & err.number
     Wscript.Echo "Description:  " & err.Description
     Wscript.Quit (Err.number)
 End If
 On Error Goto 0
 '#############################
 ' Create List of Updates to Install
 '#############################
 Set UpdatesToInstall = CreateObject("Microsoft.Update.UpdateColl")
 For I = 0 To SearchResult.Updates.Count-1
     set Update = SearchResult.Updates.Item(I)
     If Update.IsDownloaded = true Then
         UpdatesToInstall.Add(Update)
     End If
 Next
 '#############################
 ' Install Updates
 '#############################
 Set Installer = UpdateSession.CreateUpdateInstaller()
 Installer.Updates = UpdatesToInstall
 Set InstallationResult = Installer.Install()
 wscript.Echo "Installation Result: " & InstallationResult.ResultCode
 wscript.Echo "Reboot Required: " & InstallationResult.RebootRequired
 wscript.Echo "Listing of updates installed and individual installation results:"
 
     For I = 0 to UpdatesToInstall.Count - 1
         WScript.Echo I + 1 & "> " & Chr(9) & UpdatesToInstall.Item(I).Title & Chr(9) & ": " & TranslateMuCode(InstallationResult.GetUpdateResult(i).ResultCode)
     Next
 '#############################
 ' Quit
 '#############################
 WScript.Quit
 '================================================================================
 ' Translate Microsoft Update Installation Results
 '================================================================================
 Function TranslateMuCode(theCode)
   TranslateMuCode = "[" & theCode & "] "
   if (theCode = 0) Then TranslateMuCode = TranslateMuCode & "Not Started"
   if (theCode = 1) Then TranslateMuCode = TranslateMuCode & "In Progress"
   if (theCode = 2) Then TranslateMuCode = TranslateMuCode & "Succeeded"
   if (theCode = 3) Then TranslateMuCode = TranslateMuCode & "Succeeded with Errors"
   if (theCode = 4) Then TranslateMuCode = TranslateMuCode & "Failed"
   if (theCode = 5) Then TranslateMuCode = TranslateMuCode & "Aborted"
 End Function
 '================================================================================
 ' Register Microsoft Update (if never registered)
 '================================================================================
 Function RegisterMu
     Dim fso
     Dim file
     Dim WshShell
     Dim updateService
     Dim updateServiceManager
 
     found = false
 
     Set fso = CreateObject("Scripting.FileSystemObject")    
     Set WshShell = WScript.CreateObject ("WScript.Shell")
 
     Set updateServiceManager = CreateObject("Microsoft.Update.ServiceManager")
     Set updateService = updateServiceManager.Services
 
     If err <> 0 Then
         WScript.Echo "CreateObject(Microsoft.Update.ServiceManager) failed with error 0x" & Hex(err.Number)  & err.Description
         WScript.Quit(2)
     End If
     For I=0 to updateService.Count - 1
         Set item = updateService.Item(i)
         If item.ServiceID = "7971f918-a847-4430-9279-4a52d1efe18d" Then
             found = true
         End IF
     Next    
 
     IF found = false Then
         updateServiceManager.AddService2 "7971f918-a847-4430-9279-4a52d1efe18d", 2, ""
 
         If err <> 0 Then
             WScript.Echo "updateServiceManager.AddService() failed with error 0x" & Hex(err.Number) & err.Description
         Else
             WScript.Echo "MU is registered with WU Agent"
         End IF
     End IF
 END Function

Posted in: Scripts, Technical

Leave a Comment (3) →

Detect Internet Explorer Version

Someone requested how to determine what version of IE (internet explorer) was installed on a machine.
The version registry entry was unreliable so this gets the version straight from the executable.

1
2
3
4
5
6
7
8
9
10
11
12
13
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
sQuery="select * from cim_datafile where path=""\\Program Files\\Internet Explorer\\"" and filename=""iexplore"" and extension=""exe"""
set col=objWMIService.execquery(sQuery)
 
for each obj in col
    wscript.echo obj.version
next
 
set col = Nothing
Set objWMIService = Nothing

Posted in: Scripts

Leave a Comment (0) →

Deploy and run DeFraggler

This script will run Defraggler with the parameters of your choice.
It will also deploy it if its not already installed.

A full list of parameters can be found here – http://www.piriform.com/docs/defraggler/advanced-usage/command-line-parameters

**Update** – 24/10/2012
Hey guys,

Sorry but I forgot GFI ads a -logfile parameter at the end of scripts so I have updated it to prevent it passing to Defraggler.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Dim strFile
 
'Defraggler URL
strURL = "http://download.piriform.com/dfsetup211.exe"
strExecute = "dfsetup211.exe /S"
strOutput = ""
strParameters = ""
 
'Detect Arch
Set WshShell = CreateObject("WScript.Shell")
osType = WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")
 
If osType = "x86" Then
	strDF = "C:\Program Files\Defraggler\df.exe"
ElseIf osType = "AMD64" Then
	strDF = "C:\Program Files\Defraggler\df64.exe"
Else
	WScript.Echo "ERROR: Unknown Architechture " & osType
	WScript.Quit(2)
End If
 
'Get Run Parameters
Set objArgs = Wscript.Arguments
 
For Each strArg in objArgs
	If (strParameters = "") Then
		strParameters = strArg
	Else
		If InStr(strArg, "log") = 0 Then
			strParameters = strParameters & " " & strArg
		End if
	End If
Next
 
' Create a File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
If objFSO.Fileexists(strDF) Then
	RunDefragler
Else
	'Get Temp Folder
	strSaveTo = WScript.CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2)
 
	' Check if the specified target file or folder exists,
	' and build the fully qualified path of the target file
	If objFSO.FolderExists(strSaveTo) Then
		strFile = objFSO.BuildPath(strSaveTo, Mid(strURL, InStrRev(strURL, "/" ) + 1 ) )
	ElseIf objFSO.FolderExists(Left(strSaveTo, InStrRev(strSaveTo, "\" ) - 1 ) ) Then
		strFile = strSaveTo
	Else
		WScript.Echo "ERROR: Target folder not found."
		WScript.Quit(2)
	End If
 
	'Download Program
	WScript.Echo "Defraggler NOT FOUND"
	WScript.Echo "Downloading " & strURL & " to " & strSaveTo
	HTTPDownload strURL, strFile
 
	'Install program
	Set oCmd = CreateObject("Wscript.Shell") 
 
	commandLine = "%comspec% /c " & strSaveTo & "\" & strExecute 
	WScript.Echo "Running " & commandLine
	oCmd.Run commandLine, 0, True
 
	WScript.Echo "Defraggler Installed!"
	RunDefragler
 
	WScript.Quit(0)
 
End If
 
Sub RunDefragler()
	WScript.Echo "Running " & strDF & " " & strParameters
 
	Set oExec = WshShell.Exec(strDF & " " & strParameters)
 
	Do While oExec.Status <> 1
		WScript.Sleep 100
	Loop
 
	Do While oExec.StdOut.AtEndOfStream <> True 
		strOutput = strOutput & oExec.StdOut.ReadLine & vbcrlf
	Loop
 
	WScript.Echo strOutput
End Sub
 
Sub HTTPDownload(myURL, strFile)
 
 Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
 
 objXMLHTTP.open "GET", myURL, false
 objXMLHTTP.send()
 
 If objXMLHTTP.Status = 200 Then
 Set objADOStream = CreateObject("ADODB.Stream")
 objADOStream.Open
 objADOStream.Type = 1 'adTypeBinary

 objADOStream.Write objXMLHTTP.ResponseBody
 objADOStream.Position = 0 'Set the stream position to the start

 objADOStream.SaveToFile strFile
 objADOStream.Close
 Set objADOStream = Nothing
 End if
 
 Set objXMLHTTP = Nothing
End Sub

Posted in: Blog, Scripts

Leave a Comment (6) →

Exchange Queue Length Check

Heres a script to check the queue length in exchange.
Just modify the $Threshold from 10 to whatever you desire.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$snapinversion = 0;
 foreach ( $snap in get-pssnapin -registered)
 {
     if ( $snap.Name -eq 'Microsoft.Exchange.Management.Powershell.Admin' )
     {
         $snapinversion = 2007;
         Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin -ErrorAction SilentlyContinue
 
     }
     if ( $snap.Name -eq 'Microsoft.Exchange.Management.Powershell.Support' )
     {
         $snapinversion = 2010;
         Add-PSSnapin Microsoft.Exchange.Management.Powershell.Setup -ErrorAction SilentlyContinue
         Add-PSSnapin Microsoft.Exchange.Management.Powershell.Support -ErrorAction SilentlyContinue
         Add-PSSnapin Microsoft.Exchange.Management.Powershell.E2010 -ErrorAction SilentlyContinue
     }
 }
 
 if($snapinversion -eq 0)
 {
     Write-Host "Exchange Powershell Snapin missing";
     Exit 1003;
 }
 $Threshold = 10
 $MessageCount = Get-ExchangeServer | Where { $_.isHubTransportServer -eq $true } | get-queue |  foreach -begin {$total=0} -process {$total+=$_.messageCount} -end {$total}
 if ($MessageCount -gt $Threshold)
 {
 Write-Host "Warning: $MessageCount Emails in Queue.";
 Exit 1010
 } Else {
 Write-Host "$MessageCount/$Threshold Emails in Queue.";
 Exit 0
 }

Posted in: Scripts, Technical

Leave a Comment (2) →

Update Managed Antivirus

Here is a script that Updates MAV and resends the DSC information if required.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Dim WshShell, oExec, OsType, FSO, bResendDSC, MAVPath, AgentPath
 Set WshShell = CreateObject("WScript.Shell")
 Set FSO = CreateObject("Scripting.FileSystemObject")
 
 OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
 
 If OsType = "x86" then
     AgentPath = "C:\Program Files\"
 elseif OsType = "AMD64" then
     AgentPath = "C:\Program Files (x86)\"
 end if
 
 If FSO.FolderExists(AgentPath & "Advanced Monitoring Agent") Then
     AgentPath = AgentPath & "Advanced Monitoring Agent"
 ElseIf FSO.FolderExists(AgentPath & "Advanced Monitoring Agent GP") Then
     AgentPath = AgentPath & "Advanced Monitoring Agent GP"
 Else
     wscript.Echo "Agent Folder Not Found."
 End If
 
 MAVPath = Chr(34) & AgentPath & "\managedav\SBAMCommandLineScanner.exe" & Chr(34) & " /updatedefs"
 AgentPath = Chr(34) & AgentPath & "\winagent.exe" & Chr(34)
 
 bResendDSC = True
 Set oExec = WshShell.Exec(MAVPath)
 
 Do While oExec.Status <> 1
     WScript.Sleep 100
 Loop
 
 Do While oExec.StdOut.AtEndOfStream <> True 
     If oExec.StdOut.ReadLine = "DONE:Update not needed" Then
         bResendDSC = False
     End If
 Loop
 
 If bResendDSC = True Then 
     RestartDSC
     wscript.Echo "Updating MAV and resending DSC"
 Else
     wscript.Echo "MAV is up to date"
 End If
 
 Sub RestartDSC()
     'Stop agent Service
     Set oExec = WshShell.Exec(AgentPath & " /stopservice")
 
     Do While oExec.Status <> 1
         WScript.Sleep 100
     Loop
 
     'Reset DSC Counter
     Set oExec = WshShell.Exec(AgentPath & " /testreset")
 
     Do While oExec.Status <> 1
         WScript.Sleep 100
     Loop
 
     'Restart Service
     Set oExec = WshShell.Exec(AgentPath & " /startservice")
 
     Do While oExec.Status <> 1
         WScript.Sleep 100
     Loop
 End Sub

Posted in: Scripts, Technical

Leave a Comment (3) →

Restart PC if pending reboot

This script checks if there is any rename operations pending or updates pending and initiates a restart of the computer if required.
By running this on demand you can ensure that computers are rebooted only if required,minimizing the effects on users and maximising up time.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Dim strComputer
Dim strKeyPath
Dim strValueName
Dim strValue
Dim arrValues
Dim bReboot
Dim oReg
Dim objSysInfo
dim objShell
 
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_MULTI_SZ = 7
strComputer = "."
bReboot = False
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Control\Session Manager"
strValueName = "PendingFileRenameOperations"
oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrValues
 
If Not IsNull(arrValues) Then
  For Each strValue In arrValues
'Pending Rename operations found, reboot
      bReboot = True
      Exit For
  Next
Else
	'No Pending Rename operations
End If
 
'Only Check for update reboots if we need to
If bReboot = False Then
	Set objSysInfo = CreateObject("Microsoft.Update.SystemInfo")
	bReboot = objSysInfo.RebootRequired
End If
 
If bReboot = True then
	strCmd = "shutdown -r -t 120 -f /c " & chr(34) & "A system reboot has been initiated, please save all your work." & chr(34)
 
	Set objShell = CreateObject("WScript.Shell")
	objShell.Run strCmd, 0, false 
End If
 
objSysInfo = Nothing
objShell = Nothing

Posted in: Scripts, Technical

Leave a Comment (0) →

Teamviewer Settings

Here is a script that will change TeamViewer settings to disable HTTP, Activates DirectIn to stop the dialog, prevents shutdown and stops it from checking for updates.

1
2
3
4
5
6
7
Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE\SOFTWARE\TeamViewer\Version7]
"ListenHttp"=dword:00000000
"Security_ActivateDirectIn"=dword:00000001
"Security_Disableshutdown"=dword:00000001
"UpdateCheckInterval"=dword:00000002

Posted in: Scripts, Technical

Leave a Comment (0) →

Rename Computer

Here is a script to rename the computer
Make sure you add /NewName:YourNewComputerName in the script parameters and obviously change it for your naming.
Also note that each computer requires a unique name on the network to prevent conflicts so ensure the new name is unique.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
strComputerName = WScript.Arguments.Named("NewName")
 
If strComputerName <> "" then
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery ("Select Name from Win32_ComputerSystem")
 
For Each objComputer in colComputers
    wscript.echo "Old Computer Name: " & objComputer.Name
    wscript.echo "New Computer Name: " & strNewName
 
    If objComputer.Name <> strNewName Then
 
       ' rename this computer

       intErrorCode = objComputer.Rename(strComputerName)
       ' now reboot
       Reboot
    End if
Next
Else
wscript.echo "Please define a computer name!"
End If
Sub Reboot()
 
dim strComputer, objWMIService, colOS, objOS
  strComputer = "."
 
  Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
  Set colOS = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
 
  For Each objOS in colOS
                objOS.Reboot()
  Next
End Sub

Posted in: Scripts, Technical

Leave a Comment (2) →
Page 2 of 4 1234