Sign in to follow this  
Followers 0
cpremo

Really Need Help - RunAsWait Code Not working as needed

4 posts in this topic

In a previous post I had asked about running changes to a PC on Login when the person only has "User" rights to the PC. Some one gave me this command line:

$exitcode = RunAsWait($username, $domain, $password, 0, $filename, @ScriptDir)

the executible ($filename) never fired off unless I used the "RunWait($Filename)" inside the command line. However, the process doesn't quite work. I get through the script (had message boxes that showed the script ran. Yet the file I'm trying to copy to the "C:Windows" directory never gets copied. I even tried to add the "SetACL.exe" command to assign rights to the C:\Windows folder, but that doesn't seem to work either. The "Msgbox" statement - "If FileExists($Destination & $FileName) Then MsgBox(1,"","File Copied")" - never fires off and no file is found in the C:\windows directory.

This is the script that is run from the "RunWait($Filename)" inside the command line. It runs and I get the message box response, unfortunately, the file is never copied. I really could use some help!!!!

;This statement reads data from the referenced INI file to set the paramenter shown.
Dim $Location
Dim $Destination
Dim $FileName
If @OSVersion = "WIN_2000" Then
;This statement reads data from the referenced INI file to set the paramenter shown.
$Destination = IniRead ( @ScriptDir & "\ClientLogo.ini", "LogoData", "Destination2", "default" )
ElseIf @OSVersion = "WIN_XP" or @OSVersion = "WIN_VISTA" Then
;This statement reads data from the referenced INI file to set the paramenter shown.
$Destination = IniRead ( @ScriptDir & "\ClientLogo.ini", "LogoData", "Destination1", "default" )
EndIf
$FileName = IniRead ( @ScriptDir & "\ClientLogo.ini", "LogoData", "FileName", "default" )
$Location = @ScriptDir & "\" & $FileName

If not FileExists($Destination & $FileName) Then
MsgBox(1,"",@ScriptDir & "\" & $FileName & " Copied to: " & $Destination)
Dim $ALCSET = @ScriptDir & "\SetACL.exe"
Dim $test = ' -on "C:\Windows" -ot file -actn ace n:' & @ComputerName & '\users;p:full'
RunWait($ALCSET & $test, @SystemDir)
FileCopy($Location, $Destination, 9)
MsgBox(0,"",FileExists($Destination & $FileName))
EndIf

Share this post


Link to post
Share on other sites



@cpremo..Look in the Help File for "StderrRead". This way you will know if any errors take place.

Share this post


Link to post
Share on other sites

Obtained the code, but where do I place it?? Within the script, or do I create a seperate EXE file and call that one from within the script?

Share this post


Link to post
Share on other sites

@cpremo...You need to place in this script and just like the example mentioned in the Help file you need to place the while loop after you use the Run() command.

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