Brian Madden Logo
Your independent source for application and desktop virtualization.
Marketplace

advertisement

Block all logon scripts, in the Profiles / User Environment forum on BrianMadden.com

rated by 0 users
This post has 2 Replies | 0 Followers

Not Ranked
Points 35
Jason McOnie Posted: 07-30-2008 5:13 PM
I would like to block all logon scripts that are set on the User Object in Active Directory.

Is there an easy way to do it?
Top 50 Contributor
Points 2,339
Are your logon scripts residing on the OU or on the user object.

If it is just on the user object, you should just be able to delete the logon script section within the user object. If set by OU, then you may have to look at creating a group that denies access to that GPO and then put the user in that.

Cheers

Jase
  • | Post Points: 5
Top 10 Contributor
Points 14,894
Hi Jason,

It sounds like you have tons of user account objects where you need to clear the logon script value (profile tab). The script below will clear the logon script value on the profile tab of the user object for all users within the target OU.

Const ADS_PROPERTY_CLEAR = 1

Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
Set objOU = GetObject("LDAP://" & strDNSDomain)

objOU.Filter = Array("user")

For Each objUser in objOU

' This one Clears it if you just want to Clear it
objUser.PutEx "scriptPath", "", ADS_PROPERTY_CLEAR
objUser.SetInfo
Next

Note that you may need to change the strDNSDomain value to reference a target OU that you want to affect this change on if you don't want to change the value for all users in AD.

Cheers,

Alan Osborne
President (MCSE, CCNA, VCP, CCA)
VCIT Consulting - Citrix/Terminal Services Remote Desktop Solutions for SMB
p: 604-288-7325
c: 778-836-8025
web: http://www.vcit.ca
blog: http://www.vcit.ca/wordpress

  • | Post Points: 5
Page 1 of 1 (3 items) | RSS
Copyright © 1997-2008 The Brian Madden Company, LLC | Disclosures | Privacy | Terms of Use | Contact Info