cpremo Posted June 16, 2008 Posted June 16, 2008 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. ************************************************* ;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(1,"","Step 1a") If FileExists($Destination & $FileName) Then MsgBox(1,"","File Copied") EndIf
Bert Posted June 16, 2008 Posted June 16, 2008 when you do the check for fileexist, just do this to see what is happening - msgbox(0, "", fileexist($Destination & $FileName)) this will give a prompt letting you know if your script path is corret or not. Using a "IF" statement is not the best way to go when you need to do a simple check. With this check, you should get either a 1 or a 0. 1 being it is there, 0 not there. The Vollatran project My blog: http://www.vollysinterestingshit.com/
cpremo Posted June 16, 2008 Author Posted June 16, 2008 OK, I see your point, but the issue still remains, what can I do to get the file to copy???? For some reason the "RunAs" administrator isn't working!!!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now