Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Need help with Script.

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2161
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Need help with Script.
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Need help with Script. - 2/24/2005 6:48:24 AM   
  alienprotein

 

Posts: 44
Score: 0
Joined: 2/23/2005
From: USA
Status: offline
I am new to vb script, but feel I have a decent grasp on it. I have the following script that mapps printers, and shares based on group membership. I have an issues with this script, and wanted to get some feedback.


1. 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
Source:(null)


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.

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
 
 
Post #: 1
 
 Re: Need help with Script. - 2/24/2005 7:03:52 AM   
  esnmb

 

Posts: 441
Score: 0
Joined: 1/11/2005
From: USA
Status: offline
Not really sure, but what about the local policy on the machine?

(in reply to alienprotein)
 
 
Post #: 2
 
 Re: Need help with Script. - 2/24/2005 7:44:53 AM   
  mbouchard


Posts: 1856
Score: 14
Joined: 5/15/2003
From: USA
Status: offline
What errors are being reported in event viewer?

(in reply to alienprotein)
 
 
Post #: 3
 
 Re: Need help with Script. - 2/24/2005 9:26:29 AM   
  alienprotein

 

Posts: 44
Score: 0
Joined: 2/23/2005
From: USA
Status: offline
I have gone back and 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.

I have been looking at event viewer, and no errors are reported for this issue.

(in reply to alienprotein)
 
 
Post #: 4
 
 Re: Need help with Script. - 2/24/2005 10:23:27 AM   
  alienprotein

 

Posts: 44
Score: 0
Joined: 2/23/2005
From: USA
Status: offline
Note: It only seems to have the problem when it is checking the group membership against Active Directory

(in reply to alienprotein)
 
 
Post #: 5
 
 Re: Need help with Script. - 2/24/2005 11:09:48 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Do you have a GPO setting at a higher level of the domain hierarchy that might prevent it from running with no override enabled ? You might have to check each node all the way to the domain.

(in reply to alienprotein)
 
 
Post #: 6
 
 Re: Need help with Script. - 2/25/2005 1:07:54 AM   
  alienprotein

 

Posts: 44
Score: 0
Joined: 2/23/2005
From: USA
Status: offline
I will check this out ASAP.

(in reply to alienprotein)
 
 
Post #: 7
 
 Re: Need help with Script. - 2/25/2005 2:56:11 AM   
  alienprotein

 

Posts: 44
Score: 0
Joined: 2/23/2005
From: USA
Status: offline
I have verified that there are no other Policies at a higher level of my Test OU. I did have one at a lower level for testing SUS, and have removed it. This did not resolve the issue.

I have also created a local software restriction Rule on the local machine:
Type: Path Rule c:\documents and settings\testuser\*.vbs = Unrestricted

It still generates the 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
Source:(null)

(in reply to alienprotein)
 
 
Post #: 8
 
 Re: Need help with Script. - 2/25/2005 3:19:44 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Local policy has the lowest priority is ignored if there are any site, domain, or OU level GPO in effect. Is there anything in the event viewer ? Based on the error you received, I'll have to conclude that there is at least ONE policy that's set to restrict the use of the script.

(in reply to alienprotein)
 
 
Post #: 9
 
 Re: Need help with Script. - 2/25/2005 4:31:25 AM   
  alienprotein

 

Posts: 44
Score: 0
Joined: 2/23/2005
From: USA
Status: offline
I would agree with you, however I can not figure out what policy. If only we where not forced to run XP SP2, how easier life would be.

(in reply to alienprotein)
 
 
Post #: 10
 
 Re: Need help with Script. - 2/25/2005 9:02:10 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Do you have another machine without SP2 that you can use to test whether SP2 is the cause of the problem ?

NOTHING in the Event Log ?

What about enable block policy inhertance on the Test OU (not that it matters if no override is set at a higher node, but I think it's worth a try).

(in reply to alienprotein)
 
 
Post #: 11
 
 RE: Re: Need help with Script. - 9/8/2005 10:07:11 AM   
  Slocketman

 

Posts: 1
Score: 0
Joined: 9/8/2005
Status: offline
I think I found it!

I found this thread off google looking for the solution to this exact same problem, I have a Windows 2003 domain with a bunch of XP SP2 PC's that would do this error every time my vbscript logon script tried to map their printers. I was temporarily adding the user as a local computer administrator, which would solve the problem, but that wasn't a very good solution. So I kept searching google and yahoo and finally found the answer with yahoo:

In the group policy editor on your domain controller, go to
User Configuration -> Administrative Templates -> Control Panel -> Printers
and disable "Point and Print Restrictions". This solved the problem for me, hope it helps!

(in reply to token)
 
 
Post #: 12
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Need help with Script. Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts