I am rather new to vb script, but feel I have a decent grasp on it. I have the following script that map's printers, and shares based on group membership. I have an issues with this script running against a Windows XP SP2 system, and wanted to get some feedback.
I have posted on other forums relating to VBScript,and WSH, but no one had a clue. The script runs fine until it gets to the part where it verifies group mambership from AD.
I have been successfull at getting it to run on our windows 2000 machines, and had good success with XP SP1, but now I am having issues with Windows XP SP2. The script will install the "Non-Group" assigned items, but when I get to the group assigned items I get the following error:
Script: test.vbs
Line: 60
Char: 5
Error: Windows cannot open this program because it has been prevented by a software restriction policy. For more information, open event viewer or contact your system administrator.
Code: 800704EC
Sourcenull)
I have been looking at event viewer, and no errors are reported for this issue.
I have the software restriction policies for my Test OU set to allow vbs to run on this specific mechine, as well as from the SYSVOL share. Windows Firewall, and security center are both disabled, so I know that is not the cause. I can not figure out why the "non-group" associated resources are getting installed without error, but when I get to the Group associated items it generates the above error.
Here are my Software Restrictions rules:
created the following software restriction Rules:
Type: Path Rule \\wklaw.net\sysvol\wklaw.net\scripts\*.* = Unrestricted
Type: Path Rule *.vbs = Unrestricted
Type: Path Rule %WINDIR%\System32\*.VBS = Unrestricted
I have verified that these policies have been applied to the local machine from Active Directory. I have tested it and still the exact same error.
In addition to all of teh above, I have also verified that I have no other Policies in place above this OU.
Has anyone seen this? If so, how do I resolve this?
Option Explicit
Dim objNetwork, objUser,
Dim WScript, net, WshNetwork
Dim currentuser, strGroup
Set objNetwork = CreateObject("WScript.Network")
' Forces script to skip errors
' On Error Resume Next
Set objUser = CreateObject("ADSystemInfo")
Set currentuser = GetObject("LDAP://" & objUser.UserName)
strGroup = LCase(Join(currentuser.MemberOf))
'*************************
'*Install Global Printers*
'*************************
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\DA2UTL01\McK-15", "McK-15 (Color)"
net.AddWindowsPrinterConnection "\\DA2UTL01\McK-20", "McK-20 (High Speed)"
net.AddWindowsPrinterConnection "\\DA2UTL01\McK-30", "McK-30 (High Speed)"
net.AddWindowsPrinterConnection "\\DA2UTL01\McK-40", "McK-40 (High Speed)"
'*************************************************
'*NETWORKDRIVES THAT ARE AVAILABLE FOR EVERY USER*
'*************************************************
objNetwork.MapNetworkDrive "q:", "\\da1fls01\files"
objNetwork.MapNetworkDrive "H:", "\\Da1DC101\home\" & objNetwork.UserName
objNetwork.MapNetworkDrive "G:", "\\Da2fls02\working_files"
'********************************************
'*Installs Printers for the Tech Files group*
'********************************************
If InStr(strGroup, "cn=Tech Files") Then
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-73 (TF)", "AK-73 (TF)"
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-74 (Color)", "AK-74 (Color)"
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-75 (TF)", "AK-75 (TF)"
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-77 (MF)", "AK-77 (MF)"
End If
'*****************************************
'*Installs Printers for the Medical Group*
'*****************************************
If InStr(strGroup, "cn=Medical") Then
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-80 (Medical)", "AK-80 (Medical)"
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-79 (medical)", "AK-79 (medical)"
End If
'*******************************************
'*Installs Printers for the 7th Floor Users*
'*******************************************
If InStr(strGroup, "cn=Test") Then
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-82 (Color)", "AK-82 (Color)"
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-83 (7th)", "AK-83 (7th)"
End If
'Concordance - Note Only Concordance indexing users are assigned to this group.
If InStr(strGroup, "cn=Index QC") Then
objNetwork.MapNetworkDrive "k:", "\\DA2fls01\Test"
objNetwork.MapNetworkDrive "I:", "\\DA1fls01\images"
objNetwork.MapNetworkDrive "o:", "\\DA1fls01\ocr"
End If
Any help on this would be great.
I have posted on other forums relating to VBScript,and WSH, but no one had a clue. The script runs fine until it gets to the part where it verifies group mambership from AD.
I have been successfull at getting it to run on our windows 2000 machines, and had good success with XP SP1, but now I am having issues with Windows XP SP2. The script will install the "Non-Group" assigned items, but when I get to the group assigned items I get the following error:
Script: test.vbs
Line: 60
Char: 5
Error: Windows cannot open this program because it has been prevented by a software restriction policy. For more information, open event viewer or contact your system administrator.
Code: 800704EC
Sourcenull)
I have been looking at event viewer, and no errors are reported for this issue.
I have the software restriction policies for my Test OU set to allow vbs to run on this specific mechine, as well as from the SYSVOL share. Windows Firewall, and security center are both disabled, so I know that is not the cause. I can not figure out why the "non-group" associated resources are getting installed without error, but when I get to the Group associated items it generates the above error.
Here are my Software Restrictions rules:
created the following software restriction Rules:
Type: Path Rule \\wklaw.net\sysvol\wklaw.net\scripts\*.* = Unrestricted
Type: Path Rule *.vbs = Unrestricted
Type: Path Rule %WINDIR%\System32\*.VBS = Unrestricted
I have verified that these policies have been applied to the local machine from Active Directory. I have tested it and still the exact same error.
In addition to all of teh above, I have also verified that I have no other Policies in place above this OU.
Has anyone seen this? If so, how do I resolve this?
Option Explicit
Dim objNetwork, objUser,
Dim WScript, net, WshNetwork
Dim currentuser, strGroup
Set objNetwork = CreateObject("WScript.Network")
' Forces script to skip errors
' On Error Resume Next
Set objUser = CreateObject("ADSystemInfo")
Set currentuser = GetObject("LDAP://" & objUser.UserName)
strGroup = LCase(Join(currentuser.MemberOf))
'*************************
'*Install Global Printers*
'*************************
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\DA2UTL01\McK-15", "McK-15 (Color)"
net.AddWindowsPrinterConnection "\\DA2UTL01\McK-20", "McK-20 (High Speed)"
net.AddWindowsPrinterConnection "\\DA2UTL01\McK-30", "McK-30 (High Speed)"
net.AddWindowsPrinterConnection "\\DA2UTL01\McK-40", "McK-40 (High Speed)"
'*************************************************
'*NETWORKDRIVES THAT ARE AVAILABLE FOR EVERY USER*
'*************************************************
objNetwork.MapNetworkDrive "q:", "\\da1fls01\files"
objNetwork.MapNetworkDrive "H:", "\\Da1DC101\home\" & objNetwork.UserName
objNetwork.MapNetworkDrive "G:", "\\Da2fls02\working_files"
'********************************************
'*Installs Printers for the Tech Files group*
'********************************************
If InStr(strGroup, "cn=Tech Files") Then
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-73 (TF)", "AK-73 (TF)"
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-74 (Color)", "AK-74 (Color)"
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-75 (TF)", "AK-75 (TF)"
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-77 (MF)", "AK-77 (MF)"
End If
'*****************************************
'*Installs Printers for the Medical Group*
'*****************************************
If InStr(strGroup, "cn=Medical") Then
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-80 (Medical)", "AK-80 (Medical)"
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-79 (medical)", "AK-79 (medical)"
End If
'*******************************************
'*Installs Printers for the 7th Floor Users*
'*******************************************
If InStr(strGroup, "cn=Test") Then
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-82 (Color)", "AK-82 (Color)"
net.AddWindowsPrinterConnection "\\DA1UTL01\AK-83 (7th)", "AK-83 (7th)"
End If
'Concordance - Note Only Concordance indexing users are assigned to this group.
If InStr(strGroup, "cn=Index QC") Then
objNetwork.MapNetworkDrive "k:", "\\DA2fls01\Test"
objNetwork.MapNetworkDrive "I:", "\\DA1fls01\images"
objNetwork.MapNetworkDrive "o:", "\\DA1fls01\ocr"
End If
Any help on this would be great.