Jump to content
Sign in to follow this  
SergeiK

RunAs with functions

Recommended Posts

SergeiK

Dear Script Experts,

Please, assist me to make the below code running.. I would like to run some app by logon script from the nearest domain controller, but fail. If I specify a domain cotroller explicitly - it works fine, but this code "@LogonServer & "\NETLOGON\PC\H\go.exe"" does not work... Thanks in advance!!

$UserID = "XXX";

$Password = "XXX";

RunAs ($UserID,@LogonDomain,$Password,0, @LogonServer & "\NETLOGON\PC\H\go.exe");

Share this post


Link to post
Share on other sites
AdmiralAlkex

Hi and Welcome to the forums!!

Maybe @LogonServer isn't what you think it is? Have you made sure?

You could show it with a MsgBox() or ConsoleWrite() (shows at the bottom of SciTE).

Example:

MsgBox(0, "", @LogonServer & "\NETLOGON\PC\H\go.exe")

Share this post


Link to post
Share on other sites
SergeiK

Thanks a lot for your reply!! Yes, this is what I need (verified): \\%logonserver%\NETLOGON\PC\H\go.exe. But the problem remains..

Kind regards,

Sergei

Share this post


Link to post
Share on other sites
AdamUL

Look at DriveMapAdd, it should do what you need. For Example:

DriveMapAdd("", "\\" & @LogonServer & "\NETLOGON\PC\H", 0, @LogonDomain & "\" & $UserID, $Password)

Adam

Share this post


Link to post
Share on other sites
martin

Does @LogonServer contain a space perhaps?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
SergeiK

Hello to All,

Thanks - I have worked around the issue myselft. The problem was with windows variables when you use runas...

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  

×