Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WMI classname/value for pending file rename or reboots?

Status
Not open for further replies.

josephk73

Technical User
Aug 1, 2002
115
GB
All,

When a computer needs a reboot, it writes the information to the following registry key:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations

The value for the key is a multistring that gives details about the reboot etc.

Does anybody know if there is a class in WMI that can return this information - ie the computer needs a reboot?

Any help would be fantastic.

R,

Ken
 
Check this out...

Code:
'set constant for the registry root
Const HKEY_CLASSES_ROOT  = &H80000000
Const HKEY_CURRENT_USER  = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS         = &H80000003

strComputer = "."
 
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
					strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SYSTEM\CurrentControlSet\Control\Session Manager"
strValueName = "PendingFileRenameOperations"

Return = objReg.GetMultiStringValue(HKEY_LOCAL_MACHINE,strKeyPath,_
    strValueName,arrValues)
If (Return = 0) And (Err.Number = 0) Then   
' Treat the multistring value as a collection of strings 
'    separated by spaces and output
    For Each strValue In arrValues
    WScript.Echo  strValue
Next
Else
    Wscript.Echo "GetMultiStringValue failed. Error = " & Err.Number
End If

Please tell me if I'm wrong I like to learn from my mistakes...
_____________________________________
Feed a man a fish and feed him for a day.
Teach a man to fish and feed him for a lifetime...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top