Sign in to follow this  
Followers 0
Pete Zerger

Using @LogonServer macro in a Run() statement

6 posts in this topic

I want users to run a script, based on their authenticating domain controller. I have copies of a target script in NETLOGON and has replicated to all DCs. Here's the script

;Hide any fatal error messages

Opt("RunErrorsFatal", 0)

;Call this vbscript from netlogon on the authenticating DC

Run("@LogonServer\netlogon\localscript.vbs ScriptArgHere")

The error I get says "Unable to execute external program". I know I've seen this work in the past, but cannot get the syntax right. Any thoughts on how to make this work?

Share this post


Link to post
Share on other sites



Welcom to AutoIt

You are using @LogonServer between quotes

Try this:

Run('"' & @LogonServer & '\netlogon\localscript.vbs ScriptArgHere"', @WorkingDir)

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

It gives me the same error, but when I print the string to the screen (see below), the string looks correct. It gives me "\\myauthdc\netlogon\localscript.vbs ScriptArgHere". If I throw that string in a Run box, it works like a champ. Not sure why it wont fly from my AutoIT script.

$localscript = '"' & @LogonServer & '\netlogon\localscript.vbs ScriptArgHere"'

$var = @LogonServer

MsgBox ( 4096, "Testing", $localscript)

Share this post


Link to post
Share on other sites

Hi,

try same command with _RunDos()

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

I forgot you're trying to run a vbs script.

you can try as th.meger suggested but don't forget to add the following line at the begging of your script

#include <Process.au3>

Or

try

Run(@ComSpec & ' /c "' & @LogonServer & '\netlogon\localscript.vbs ScriptArgHere"', @WorkingDir)


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

Danny, that last suggestion works like a champ. Thanks very much to all.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0