Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Scipt running through GPO

Status
Not open for further replies.

GCFG

Technical User
Dec 4, 2007
13
0
0
GB
I have applied a VB Script through Group policy to a Set of Users. Logging onto their machine the policy applies fine, when logging onto application server's they have access to, the policy will run on some of the server's but not on all (i would like it to not run on any of the servers). can somebody tell me if there is a setting which i need to change to stop the Script from Running on all servers?

Cheers
 
I believe you can add a GPO to the application servers to prevent logon scripts. I'll have to research exactrly where in the Computer part of that GPO that would prevent that.

Also, I am sure there is a way in VBScripting to have it check the class of machine they are loggin on to...(i.e. workstation or server class)

There are some great resources in our VBScript Forum

_______________________________________
Great knowledge can be obtained by mastering the Google algorithm.
 
Thanks for the quick response, i have had a quick look at the thread but cannot see anything about been able to determine the class of the machine.
 
You can have your script check the OU of the computer to which you are logging on.

I have some procedures that run via the logon script that I only want to run if their machine is in a specific OU. You could also code it to NOT run if the current machine is in a specific OU.


What this does is this...you set computerOU as the OU a computer must be in for the stuff to run. You get the length of that veriable, and compare it with the right side of the current ou, and if they match, it does the stuff in question.

The reason you compare it to the right side of the OU and not the whole thing is so it runs for sub-OUs as well.

Hope this helps. Post any questions here.

Code:
Set objSysInfo  = CreateObject("ADSystemInfo")
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)

computerOU      = "DC=myOU,DC=mycompany,DC=com"
currentOU = Right(UCase ("LDAP://" & objSysInfo.ComputerName),Len (computerOU))


If currentOU = computerOU Then
		'do stuff
End If

Thanks,
Andrew

[medal] Hard work often pays off over time, but procrastination pays off right now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top