Archive for October, 2011

Check Windows 7 Activation Using VBS

So i had some issues trying to use windows activation and wanted to be able to report on the OS status using BGInfo.

My below script can be referenced  inside BGInfo.

I might be worth downloading WMI Code Creator v1.0 This can be used to show what other information is ready for the picking.

Editing the below script will be able to report on any of the records WMI can throw your way.

 

Copy and paste the following code into a new .vbs file


Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From SoftwareLicensingProduct")
Coltest = int(0)
IsWinActivated = True

For Each objitem In colItems
IF int(objitem.GracePeriodRemaining) = 0 Then Coltest = True else Coltest = False
IF Coltest = False then IsWinActivated = False
Next

IF IsWinActivated = False then
call echo "Failed"
ELSE
call echo "Successful"
END IF