Hi I have created a VBS script to install multiple windows patch, but i am facing one problem that if one user run the script other user cannot launch that script because its give access denied error and once patch installation finish in one user than another
user can use it.
So can anyone help me how to modify it so that everyone can run it individually at same time.
please find the script
Dim fso, logFile, scriptDir
scriptDir = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))
Set fso = CreateObject("Scripting.FileSystemObject")
Set logFile = fso.OpenTextFile(scriptDir & "MicrosoftUpdatesInstall.log", 8, True)
logFile.WriteLine "==============================================================================="
logFile.WriteLine Now()
'=======================================================================
' Please place the updates in a folder and modify the below folder path
spPatchFolder = "\\hridnp1\common$\All Staff\General Info\Outlook Patch"
'=======================================================================
InstallPatches(spPatchFolder)
logFile.WriteLine "==============================================================================="
MsgBox "Microsoft updates installation completed successfully!",64, "Microsoft updates"
Set fso = Nothing
Set logFile = Nothing
WScript.Quit
Function InstallPatches(sFolder)
Set objfso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
Set folder = objfso.GetFolder(sFolder)
Set files = folder.Files
For each sFile In files
If Ucase(Right(sFile.name,3)) = "EXE" Then
'cmd.exe /c <file name>.exe /quiet /norestart
i=objShell.Run ("Cmd.exe /c" & Chr(34) & sfolder &"\"&sFile.name &chr(34) &" /quiet /norestart", 1, True)
If i = 0 Or i = 3010 Then
logFile.WriteLine chr(34) & folder & "\" & sFile.name & chr(34) & " installation completed Successfully"
Else
logFile.WriteLine chr(34) & folder & "\" & sFile.name & chr(34) & " installation failed. Exit Code: " & i
End If
End If
Next
For Each Subfolder in folder.SubFolders
InstallPatches(Subfolder)
Next
Set objfso = Nothing
Set objShell = Nothing
Set folder = Nothing
Set files = Nothing
End Function
Rakesh Kumar