ADSI Question 
Author Message
 ADSI Question

Is this an ADSI problem?  When I run this script and create shares on a 2000
Server all's well. However, it bombs out on the NEWSHARE.SETINFO on NT 4.0
servers.  They have IE 5.5 SP1 and ADSI 2.5 installed.  Also, if my drive Z:
exists already the script will bomb out.

Thanks for the help in advance.

Jon

Set FSO = CreateObject("Scripting.FileSystemObject")
Set Network = WScript.CreateObject("WScript.Network")
Set Shell = WScript.CreateObject("WScript.Shell")
Set DomainObj = GetObject("WinNT://MyDomain")
UserNameVar = inputbox("Please enter the new users USERNAME only", "Create
Share")
UserShare = UserNameVar & "$"
 If UserNameVar <> "" Then
  Server = inputbox("Which server do you wish to create the share on?" &
Chr(13) & chr(13) _
  & "SERVER01, SERVER02, or SERVER03" & Chr (13), "Select Server",
"SERVER01")
  If Server <> "" then

   Network.MapNetworkDrive "z:", "\\" & Server &"\Users$"
   FSO.CreateFolder("z:\" & UserNameVar)
   Set HomeServerObj = GetObject("WinNT://MyDomain/" & Server &
"/lanmanserver")
   set newshare = HomeServerObj.create("fileshare", UserNameVar & "$")
   newshare.path = "E:\Users\" & UserNameVar
   newshare.setinfo
   Shell.run "%comspec% /c ECHO Y|cacls z:\" & UserNameVar & " /t /g " &
UserNameVar & ":C",2, true
   Shell.run "%comspec% /c ECHO Y|cacls z:\" & UserNameVar & " /e /t /g
Administrators:F",2, true
   Network.RemoveNetworkDrive "z:"
   WScript.echo "Hidden Share "& UserShare & " Created"
  Else
   WScript.echo "A Server must be selected. ", "Operation Cancelled"
  End If
 Else
  WScript.echo "A User Name was not selected. ","Operation Cancelled."
 End If



Fri, 19 Dec 2003 21:06:55 GMT  
 ADSI Question
i am by no means an expert in this, but i recently had to
write a simlar script, and the major difference that i see
between them is that the line in your script:

Set DomainObj = GetObject("WinNT://MyDomain")

looks like this in mine:

Set DomainObj = GetObject("WinNT://MyDomain/lanmanserver")

hope this helps.

Quote:
>-----Original Message-----
>Is this an ADSI problem?  When I run this script and

create shares on a 2000
Quote:
>Server all's well. However, it bombs out on the

NEWSHARE.SETINFO on NT 4.0
Quote:
>servers.  They have IE 5.5 SP1 and ADSI 2.5 installed.  

Also, if my drive Z:
Quote:
>exists already the script will bomb out.

>Thanks for the help in advance.

>Jon

>Set FSO = CreateObject("Scripting.FileSystemObject")
>Set Network = WScript.CreateObject("WScript.Network")
>Set Shell = WScript.CreateObject("WScript.Shell")
>Set DomainObj = GetObject("WinNT://MyDomain")
>UserNameVar = inputbox("Please enter the new users

USERNAME only", "Create
Quote:
>Share")
>UserShare = UserNameVar & "$"
> If UserNameVar <> "" Then
>  Server = inputbox("Which server do you wish to create
the share on?" &
>Chr(13) & chr(13) _
>  & "SERVER01, SERVER02, or SERVER03" & Chr (13), "Select
Server",
>"SERVER01")
>  If Server <> "" then

>   Network.MapNetworkDrive "z:", "\\" & Server &"\Users$"
>   FSO.CreateFolder("z:\" & UserNameVar)
>   Set HomeServerObj = GetObject("WinNT://MyDomain/" &
Server &
>"/lanmanserver")
>   set newshare = HomeServerObj.create("fileshare",
UserNameVar & "$")
>   newshare.path = "E:\Users\" & UserNameVar
>   newshare.setinfo
>   Shell.run "%comspec% /c ECHO Y|cacls z:\" &

UserNameVar & " /t /g " &
Quote:
>UserNameVar & ":C",2, true
>   Shell.run "%comspec% /c ECHO Y|cacls z:\" &

UserNameVar & " /e /t /g
Quote:
>Administrators:F",2, true
>   Network.RemoveNetworkDrive "z:"
>   WScript.echo "Hidden Share "& UserShare & " Created"
>  Else
>   WScript.echo "A Server must be selected. ", "Operation
Cancelled"
>  End If
> Else
>  WScript.echo "A User Name was not

selected. ","Operation Cancelled."

- Show quoted text -

Quote:
> End If

>.



Thu, 01 Jan 2004 03:31:11 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Stupid VBScript/ADSI question

2. ADSI Question

3. Another ADSI question...

4. Stupid VBScript/ADSI question

5. ADSI Question

6. ADSI questions user properties

7. ADSI question

8. ADSI Question

9. ADSI question

10. ADSI question (can I just installl it on our PDC?)

11. ADSI question (can I just installl it on our PDC?)

12. VBS and ADSI Object begginer question.

 

 
Powered by phpBB® Forum Software