How to run a script only once on a computer

Useful tip from Microsoft

----------------------------------------------------------
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\AdminScripts"
objRegistry.CreateKey HKEY_LOCAL_MACHINE, strKeyPath
strValueName = "ScriptName"
strValue = "No"
objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue

-------------------------------------------

Full article with explanations

No comments:

Recent Posts