VBScript: List MS hotfixes installed

Script below will echo out hotfixes installed on current system.  Change strComputer name to display for remote system.
Usage: cscript.exe script.vbs

==Code start==

strComputer = “.”

Set objWMIService = GetObject(“winmgmts:” _

& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)

Set colQuickFixes = objWMIService.ExecQuery _

(“Select * from Win32_QuickFixEngineering”)

For Each objQuickFix in colQuickFixes

‘ Wscript.Echo “Computer: ” & objQuickFix.CSName

Wscript.Echo “Description: ” & objQuickFix.Description

if objQuickFix.HotFixID<>”File 1″ then Wscript.Echo objQuickFix.HotFixID

wscript.Echo “Installation Date: ” & objQuickFix.InstallDate

Wscript.Echo “Installed By: ” & objQuickFix.InstalledBy

Next

==Code End==

VBScript – Get OS Name

The script below is simple – use it to get the name of the current OS (Windows XP, 7, etc).  Currently it outputs to a message box but can be used for case statements, if else, etc.


Code start

====================
on error r
esume next

sRes = Inputbox(“Enter the Server or Computer name”, “OS”)
strComputer = sRes
if strComputer = “” then
Msgbox “No server was enter, will use current computer”,vbCritical,”Warning”
strComputer = “.”
end if
Set objWMIService = GetObject(“winmgmts:\\”  & strComputer & “\root\cimv2”)
Set colItems = objWMIService.ExecQuery(“Select * from Win32_OperatingSystem”,,48)
For Each objItem in colItems
Msgbox objItem.Caption,VbInformation,”Running on ” & strComputer & ” is:”
Next
======================
Code End

Output

SCCM Collection for Laptops Only

When creating a collection for laptops you have to include the “Chassis Type” numbers. The problem with this is that laptops/portables/pen tops all have different enclosures

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on SMS_G_System_SYSTEM_ENCLOSURE.ResourceID = SMS_R_System.ResourceId where
SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes in ( “8”, “9”, “10”, “14” )

You may change this as needed here is the complete list from Micrsoft:

Value Description
1 Other
2 Unknown
3 Desktop
4 Low Profile Desktop
5 Pizza Box
6 Mini Tower
7 Tower
8 Portable
9 Laptop
10 Notebook
11 Hand Held
12 Docking Station
13 All in One
14 Sub Notebook
15 Space-Saving
16 Lunch Box
17 Main System Chassis
18 Expansion Chassis
19 Sub Chassis
20 Bus Expansion Chassis
21 Peripheral Chassis
22 Storage Chassis
23 Rack Mount Chassis
24 Sealed-Case PC

How to deploy Windows 7 Taskbar Pinned Icons by Group Policy

 

Question: How to deploy Windows 7 Taskbar Pinned Icons by Group Policy

Answer: Windows 7 taskbar pinned icons are stored in the following locations:

File System:
%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

Registry:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]

To deploy it, you can perform the following steps:

  1. Configure Pinned items on a Windows 7 system as a reference computer.
  2. Export Reigstry Key to pinned.reg file:
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]
  3. And copy items in the “%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar” to a shared folder.  

Create a logon script to deploy the registry keys and copy the corresponding files.

More Information
If you want to pin items to the Start Menu, you may refer to the following script:
Pin Items to the Start Menu or Windows 7 Taskbar via Script

http://blogs.technet.com/deploymentguys/archive/2009/04/08/pin-items-to-the-start-menu-or-windows-7-taskbar-via-script.aspx

 

GPP Apply Once and Do Not Reapply

How does the client know if the GPP item is applied?  Match the UID of the FilterRunOnce setting in the XML file of the GPO on sysvol to the UID in the key below.  Delete the one item in question and perform a gpupdate /force for the setting to reapply.
  • HKCU\Software\Microsoft\Group Policy\Client\RunOnce for user settings
  • HKLM\Software\Microsoft\Group Policy\Client\RunOnce for computer settings