Change computer account properties
To change your computer account properties, demonstrate how to change the location properties of your computer account in Active Directory through scripts.
Script code:
Set objcomputer = getObject ("ldap://cn=.,cn=computers, dc=fabrikam, dc=com")
Objcomputer.put "location", "building 37, floor 2, room 2133"
Objcomputer.set Info
Activate Windows Offline
Use offline methods to activate Windows. Unexpected XP or Windows 2003, as well as a valid activation number.
Script code:
StrComputer = "."
Set objwmiservice = getObject ("WinMgmts:" & "{impersonationLevel = impersonate}! //" & strcomputer & "/ root / cimv2")
Set colwindowsproducts = objwmiservice.execQuery ("Select * from win32_windowsproductactivation")
For Each ObjWindowsProduct in ColWindowsProducts
ObjWindowsProduct.ActivateOffline ("1234-1234")
NEXT
Activate Windows online
Use an online approach to activate Windows. It is necessary to XP or Windows 2003, as well as an active Internet connection.
Script code:
StrComputer = "."
Set objwmiservice = getObject ("WinMgmts:" & "{impersonationLevel = impersonate}! //" & strcomputer & "/ root / cimv2")
SET COLWINDOWSPRODUCTS = ObjWMiservice.execQuery ("SELECT * from in32_windowsproductactivation")
For Each ObjWindowsProduct in ColWindowsProducts
ObjWindowsProduct.ActivateOnline ()
NEXT
Configure system startup delay
Configure the computer to wait for 10 seconds before starting the default operating system (not the default for 30 seconds).
Script code:
StrComputer = "."
Set objwmiservice = getObject ("WinMgmts:" & "{impersonationLevel = impersonate}! //" & strcomputer & "/ root / cimv2")
Set colStartupCommands = objWMiservice.execQuery ("SELECT * WIN32_Computersystem)
For Each ObjstartupCommand in ColStartUpCommands
ObjstartupCommand.systemStartUpdelay = 10
ObjstartupCommand.put_next
Get operating system properties
Information Gets the operating system information installed on your computer, including language types, encryption levels, and built-in numbers.
Script code:
Set dtmconverteddate = createObject ("wbemscripting.swbemdatetime")
StrComputer = "."
Set objwmiservice = getObject ("WinMgmts:" & "{impersonationLevel = impersonate}! //" & strcomputer & "/ root / cimv2")
Set coloperatingsystems = objwmiservice.execQuery ("SELECT * WIN32_OPERATISTEM")
For Each Objoteingsystem in coloperatingsystems
WScript.echo "Boot Device:" & objoodablesystem.bootDevice
WScript.echo "Build Number:" & objoteingsystem.buildnumber
WScript.echo "Build Type:" & objoteingsystem.buildtype
WScript.echo "CAPTION:" & objoteingsystem.caption
WScript.echo "Code Set:" & objoteingsystem.codset
WScript.echo "Country Code:" & objoteingsystem.countrycode
WScript.echo "Debug:" & objoteingsystem.debug
WScript.echo "Encryption Level:" & objoodingSystem.EncryptionLevel
DTMCONVERTEDDATE.VALUE = Objoteingsystem.installDate
DTMinstallDate = DTMCONVERTEDDATE.GETVARDATE
WScript.echo "Install Date:" & DTMInstallDate
WScript.echo "licensed users": "& objoodativesystem.numberoflicensedusers
WScript.echo "Organization:" & objoteingsystem.organization
Wscript.echo "OS Language:" & objoodablesystem.oslanguage
WScript.echo "OS Product Suite:" & objoteingsystem.osproductsuite
WScript.echo "OS Type:" & objoteingsystem.Ostype
WScript.echo "Primary:" & objoteingsystem.primary
Wscript.echo "Registered User:" & objoodativesystem.registereduserwscript.echo "Serial Number:" & objoteingsystem.serialnumber
WScript.echo "Version:" & objoteingsystem.version
NEXT