WMI script to check for pending file rename operations
Tom Mills posted a great post on his blog about a handy wmi script to check fo pending file rename operations.
http://blogs.msdn.com/tommills/archive/2008/08/15/a-handy-wmi-script-for-checking-for-pending-file-rename-operations.aspx
'---------------------------------------------------------------------
'Name: CheckPendingFileRenameOperations
'Programmer: Tom Mills/Microsoft Corp.
'Date: 8/14/2008
'Purpose: Checks registry key for pending file rename operations
'Notes: None
'---------------------------------------------------------------------
CONST HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
strFileOps = ""
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
For Each strValue In arrValues
strFileOps = strFileOps & chr(13) & strValue
Next
WScript.Echo "Pending File Rename Operations Found: " & strFileOps
Else
If Err.Number = 0 Then
Wscript.Echo "No Pending File Operations Found"
Else
Wscript.Echo "Check Pending File Operations failed. Error = " & Err.Number
End If
End If
Trackbacks
No Trackbacks
Comments