I'm having problems with this vb script. All works how we want apart from the "else" statement at the end. We want users who aren't a member of MANAGERS group to run the registry file remove.reg. The update works for users who are members of MANAGERS group and have the application on their PC C:\Program Files\Hewlett-Packard\HP\network.exe. Hope someone can help, I'm new to scripting.
Set WSHNetwork = CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
strfolderpath = objShell.ExpandEnvironmentStrings("%appdata%\Hewlett-Packard\")
Set UserObj = GetObject("WinNT://" & WSHNetwork.UserDomain & "/" & WSHNetwork.UserName)
For Each GroupObj In UserObj.Groups
Select Case UCase(GroupObj.Name)
Case "MANAGERS"
set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("C:\Program Files\Hewlett-Packard\HP\network.exe") Then
filesys.CopyFile "V:\HP\Configuration\*", strfolderpath
WshShell.run "regedit /S ""C:\update.reg""",0,True
Else
WshShell.run "regedit /S ""C:\remove.reg""",0,True
End If
End Select
Next
<message edited by spectrum1 on Monday, December 05, 2011 9:52 AM>