Re: Scrip Help
- From: "Michael Harris \(MVP\)" <mikhar.at.mvps.dot.org>
- Date: Fri, 22 Jun 2007 09:29:59 -0700
gbrown135 wrote:
I have created this script to remove a user's home drive from the
server by reading AD. The script is as follows: Can you check why
this doesn't work?
dim strUser, strDomain, strUserDN
dim objUser, objTrans, objFSO, objFolder
dim HomeShare
Const ForReading = 1
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
strUser = InputBox("Enter User Name")
strDomain = "Globalinfra"
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_INITTYPE_GC, ""
objTrans.Set ADS_NAME_TYPE_NT4, strDomain & "\" & strUser
strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
Set objUser = GetObject("LDAP://" & strUserDN)
HomeShare = objUser.homeDirectory
set objFSO = createobject("scripting.filesystemobject")
objFolder = objFSO.GetFolder(HomeShare)
You need the Set statement for an object reference. Without it all you get
is the default property (or an assignment error if there is no default
property).
Set objFolder = objFSO.GetFolder(HomeShare)
objFolder.Delete True
This is still however getting an error on line objFolder.Delete True
it comes with an error saying: Object required:
'\\Serevrname\Homedrive$'. I think that due to my Home Drive being in
ShareName rather than UNC format. Maybe i will need to query server
first. Do you know how that is done?
--
Michael Harris
MVP- Admin Frameworks
.
- Prev by Date: Re: Export Local Account Password
- Next by Date: Re: Copy Active directory Users to a SQL DB table - Daily
- Previous by thread: Re: Export Local Account Password
- Next by thread: Urgent!!! Base24 Professionals for Singapore
- Index(es):
Relevant Pages
|