Hope someone might help me out, since I'm stuck.
I have to search the registry of several computers to find if there is a
"PendingFileenameOperation" waiting. After some try and error, I've come up
with this solution where I read the registry and add all entries' to an
array, and then add each arrayitem to a string. I then intend to search the
string for a certain path. If the count is above 0 I have a
PendingFileRenameOperation" that requires a reboot.
My problem is as follows:
1) Is this the best way to solve this problem
2) I cant get my regular expression to work.
The code I've come up with is as follows:
dim strPending, strSessionManager , strAllText
Dim arrFiles ''array containing files that are being renamed
Set objRegEx = CreateObject("VBScript.Regexp")
objRegEx.Global = True
objRegEx.Pattern = "C:\Norman" ''regular expression finding all entries
strPending = "PendingFileRenameOperations" ''The regkey we're going to read
Set objShell = CreateObject("WScript.shell")
arrFiles=objShell.Regread(strSessionManager & strPending) 'put all entries
in registry into the array
for each StrFile in arrFiles
strAllText= strAllText & " " & strFile ''add all entries into one long
string with spaces
set colMatches = objRegEx.Execute(strAllText)
if colMatches.count > 0 then
''Do something if there are keys in the given directory that is pending a
Any feedback would be greatly appreciated.