buzzard Posted August 13, 2009 Posted August 13, 2009 Hi all, apologies for this, I've done it before but forgot the exact code! I need a logon vbs to check if the user logging on is on a computer in the "admin" ou which houses the Admin PC's. If the answer is yes then Map the network drive... for the life of me I can't get what I did last time where I used to work... TIA
srochford Posted August 13, 2009 Posted August 13, 2009 This should get you started: set oNet=createobject("wscript.network") set oSysinfo=createobject("adsysteminfo") 'get full name eg cn=pc010203,ou=finance,ou=allpcs,dc=ic,dc=ac,dc=uk sDN=lcase(oSysinfo.computername) 'separate at commas; sdata(0) will be cn=pc010203; sdata(1) will be ou=finance etc sData=split(sDN,",") sOU=mid(sdata(1),4) 'get the lowest level OU - finance here - and start at 4th char; ie lose "ou=" 'find the path to map for this OU select case sOU case "finance" sPath="\\server1\fin_data" case "admin" sPath="\\server2\adminstuff" end select 'and map it if sPath<>"" then oNet.mapnetworkdrive "Z:",sPath end if
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now