Archive for March, 2009

Use the below script to disable the windows firewall on XP. To enable the firewall, change the second last line from false to true. Tested on XP SP1-3.

‘Start of script :

Set objFirewall = CreateObject(”HNetCfg.FwMgr”)
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile

objPolicy.FirewallEnabled = FALSE

Msgbox “Done”

Use the below script to display the local pc BIOS version and build number. Tested against XP sp3.

‘Start of Script :

strComputer =”.”
Set objWMI = GetObject(”winmgmts:\\” & strComputer & “\root\CIMV2″)
Set colItems = objWMI.ExecQuery(”SELECT * FROM Win32_BIOS”)
For Each itm In colItems
strBIOSVersion = Join(itm.BIOSVersion, “,”)
WScript.Echo “BIOSVersion: ” & strBIOSVersion
WScript.Echo “BuildNumber: ” & itm.BuildNumber
WScript.Echo “SMBIOSBIOSVersion: ” & itm.SMBIOSBIOSVersion
WScript.Echo “SMBIOSMajorVersion: ” & itm.SMBIOSMajorVersion
WScript.Echo “SMBIOSMinorVersion: ” & itm.SMBIOSMinorVersion
WScript.Echo “Version: ” & itm.Version
Next

Use the below script to kill a process on a remote machine. In this example I’m killing off an instance of outlook.

NB. permissions are required on the remote pc or the script will fail.

‘Start of script :

‘———————————————————-

Remotekill()

‘———————————————————-
Function RemoteKill()

strComputer = “remotepcname”

On Error Resume Next

Set oWMIKill = GetObject(”winmgmts:” _
& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2″)

Set colPClogin = oWMIKill.ExecQuery _
(”Select * from Win32_Process Where Name = ‘outlook.exe’”)

For Each objProcess in colPClogin
objProcess.Terminate()
Next

Set objProcess = Nothing
Set colKeyacc = Nothing
Set colPClogin = Nothing
Set oWMIKill = Nothing

MsgBox “Kill sent to remote computer”, 64, “Remote Process Kill”

End Function
‘———————————————————-

Use the below script to discover the members of the local administrator’s group on a windows XP pc.

‘Start of script :

strComputer = “.”
Set colGroups = GetObject(”WinNT://” & strComputer & “”)
colGroups.Filter = Array(”group”)

For Each objGroup In colGroups

If objGroup.Name = “Administrators” Then

For Each objUser in objGroup.Members
szStr = szStr & objUser.Name & vbCRLF
Next

MsgBox objGroup.Name & ” Group” & vbCRLF & vbCRLF & “Members :” & vbCRLF & _
vbCRLF & szStr, 64, “Local Admin Group Members”

Exit For
End If

Next