Showing posts from August, 2010

List Add/Remove Programs on Remote Computer

Quite a handy little script for listing programs showing as installed on a remote location without having to check the registry. Modify the computer name in the script. To output the file to a text file, run from dos with a >c:\output.txt command. __________ On Error Resume Next Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20 arrComputers = Array("COMPUTERNAMEHERE") For Each strComputer In arrComputers WScript.Echo WScript.Echo "==========================================" WScript.Echo "Computer: " & strComputer WScript.Echo "==========================================" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32Reg_AddRemovePrograms", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem In colItems WScript.Echo "DisplayName: "

Running a process on a remote machine SILENTLY

Below is the contents of a script to run a process on a remote workstation. It will only run the program silently in the background. As you can't interact this is obviously only recommended to be run on processes which don't require any interaction. The process will run as the user you run the VBS script as, on the workstation specified in the script. ________ strComputer = "remotecomputername" strCommand = "notepad.exe" Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set objProcess = objWMIService.Get("Win32_Process") errReturn = objProcess.Create(strCommand, null, null, intProcessID) If errReturn = 0 Then Wscript.Echo "notepad.exe was started with a process ID: " & intProcessID Else Wscript.Echo "notepad.exe could not be started due to error: " & errReturn End If __________

GP Templates for disabling removable devices

Below is a template for additional group policies for enabling/disabling removable devices and detailed in Details of how to import the template into a Group Policy are in under How to Load the Administrative Template. You may need to select View and untick Show Policies Only for the options to appear under the custom template folder. __________________ CLASS MACHINE CATEGORY !!category CATEGORY !!categoryname POLICY !!policynameusb KEYNAME "SYSTEM\CurrentControlSet\Services\USBSTOR" EXPLAIN !!explaintextusb PART !!labeltextusb DROPDOWNLIST REQUIRED VALUENAME "Start" ITEMLIST NAME !!Disabled VALUE NUMERIC 3 DEFAULT NAME !!Enabled VALUE NUMERIC 4 END ITEMLIST END PART END POLICY POLICY !!policynamecd KEYNAME "SYSTEM\CurrentControlSet\Services\Cdrom" EXPLAIN !!explaintextcd PART !!labeltextcd DROPDOWNLIST R