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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call another vbs script NETLOGON via UNC

Status
Not open for further replies.

tmjack

IS-IT--Management
Oct 8, 2010
1
US
I have a vbs script that automatically runs when users connect to our VPN (script is local to each machine). I am attempting to have this script then call and run our logon.vbs script from \\DomainController\NETLOGON\logon.vbs so that the users have the same mapped drives and other environment options defined in this script. But, for some reason it doesn't run and I'm not sure where the issue lies. Wscript just sits as a task in task manager. I have attempted adding sleep commands, changing syntax, implementing other suggestions, but still no go. Hopefully, I am just missing something simple.

If I run the script directly (2x-click), it prompts to open and then runs fine.

... Any help is greatly appreciated...

Below is the code that is inside of the OnConnect.vbs script that runs on VPN connect:

Code:
Option Explicit
'On Error Resume Next
WScript.Sleep(20000)

'Call logon.vbs to initiate the logon script to map drives, printers, etc.
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "\\IPaddress of DC\NETLOGON\logon.vbs"

WScript.Quit
--------------------------------------------
 
Since the path contains space, you've to quote (escaped if needed) the whole path.
[tt] WshShell.Run """\\IPaddress of DC\NETLOGON\logon.vbs"""[/tt]
or
[tt] WshShell.Run chr(34) & "\\IPaddress of DC\NETLOGON\logon.vbs" & chr(34)[/tt]
 
BTW if you running Server 2003/2008 and XP/Vista/ and Win7 this can now all be done from GPO if you install Client side extensions for XP and server 2003.

MCITP:EA/SA, MCSE, MCSA, MCDBA, MCTS, MCP+I, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top