|
|
|||||||
Hello looking for a little help, hopefully this will be a quick one. using the following code. IF INGROUP("Psinstall") $Powershell = ReadValue('HKLM\SOFTWARE\Microsoft\PowerShell\1\','Install') If $Powershell <> 1 $server="@lserver\netlogon\bats\WindowsXP-KB926139-v2-x86-ENU.exe" $runaspath="@lserver\netlogon\runnas.exe" SHELL '$runaspath /user:@wksta\Administrator $server /pass:XXXXXX' Endif Endif I can not get it to use the local administrator usercode and password to run the exe.. If I use a domain level account it will work.. Can you not use the local account?? |
||||||||
|
|
|||||||
If you type runas /? at the commnand prompt it will show you the options. One of them is user:mycahine\administrator Code: H:\>runas /? RUNAS USAGE: RUNAS [ [/noprofile | /profile] [/env] [/netonly] ] /user:<UserName> program RUNAS [ [/noprofile | /profile] [/env] [/netonly] ] /smartcard [/user:<UserName>] program /noprofile specifies that the user's profile should not be loaded. This causes the application to load more quickly, but can cause some applications to malfunction. /profile specifies that the user's profile should be loaded. This is the default. /env to use current environment instead of user's. /netonly use if the credentials specified are for remote access only. /savecred to use credentials previously saved by the user. This option is not available on Windows XP Home Edition and will be ignored. /smartcard use if the credentials are to be supplied from a smartcard. /user <UserName> should be in form USER@DOMAIN or DOMAIN\USER program command line for EXE. See below for examples Examples: > runas /noprofile /user:mymachine\administrator cmd > runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc" > runas /env /user:user@domain.microsoft.com "notepad \"my file.txt\"" NOTE: Enter user's password only when prompted. NOTE: USER@DOMAIN is not compatible with /netonly. NOTE: /profile is not compatible with /netonly. |
||||||||
|
|
|||||||
But isn't that what I have here? SHELL '$runaspath /user:@wksta\Administrator $server /pass:XXXXXX' Am I doing the syntax wrong, and not seeing it? |
||||||||
|
|
|||||||
Sorry, my bad. Did not notice that It could be that the macro and the variable are not expanded to the actual value they hold because they are inside quotes. Maybe something like this would work better (did not test it) Code: SHELL $runaspath + ' /user:' + @wksta + '\Administrator ' + $server + ' /pass:XXXXXX' |
||||||||
|
|
|||||||
Sadly no go.. any other thoughts? Strange that the same syntax works for domain account but not local. and yes, the administrator usercode and password are correct. |
||||||||
|
|
|||||||
Well here is another caveat.. It works when I have the exe on a network share. But I have to supply a domain usercode and password. Therefore the password is visable in the script.. Where this is going to be on a share that others can see, how can I make the password invisible to others or have it encrypted in the script, so they can not see it.. Is this possible? |
||||||||
|
|
|||||||
If your using runnas (with 2 n's) versus runas (with 1 n), you can tokenize the command line with the /tok switch. Or even better, just tokenize the kix script itself (with the kix /t switch) ? |
||||||||
|
|
|||||||
Shawn I will see if I can figure that out. I am running the version with two n's. |
||||||||
|
|
|||||||
Shawn Do you see anything here that would cause the /quiet switch not to work? Other than being a crappy coder I need help.. Thanks. IF INGROUP("Psinstall") $Powershell = ReadValue('HKLM\SOFTWARE\Microsoft\PowerShell\1\','Install') If $Powershell <> 1 $local="%systemroot%\temp" $server="@lserver\netlogon\bats\WindowsXP-KB926139-v2-x86-ENU.exe" copy $server $local $Winpath = "$local\WindowsXP-KB926139-v2-x86-ENU.exe /quiet" $runaspath="@lserver\netlogon\runnas.exe" SHELL $runaspath + ' /user:' + @wksta + '\Administrator ' + $winpath + ' /pass:xxxxxxxx' Endif Endif |
||||||||
|
|
|||||||
Whats not being quiet ? Are you getting a DOS box appearing or is the install itself not being quite ? |
||||||||
|
|
|||||||
Yes, if you rub the install with the /quite switch in a dos box, you don't see anything, it go off an installs in the background.. With this, and the /quiet switch, first you see the files extract, and then the regular install program. I don't want the users to know that it is being installed. |
||||||||
|
|
|||||||
What if you change that last line to: SHELL $runaspath + ' /user:' + @wksta + '\Administrator ' + '"$winpath"' + ' /pass:xxxxxxxx' [Changed '$winpath' to '"$winpath"'] |
||||||||
|
|
|||||||
Sadly this does not work. It looks like the RuNNAs.exe does not appear to be able to handle these switches. Humm now what. |
||||||||
|
|
|||||||
Would have bet the house that would work. Because your trying to pass /quiet to the install, not to runnas. Sometimes what I do to debug these long funky concatenated strings is to just print it out to the console, to see how its being passed, like this: $= SetOption("WrapAtEol", "On") ? $runaspath + ' /user:' + @wksta + '\Administrator ' + '"$winpath"' + ' /pass:xxxxxxxx' The WrapAtEol ensures that the console output doesn't wrap onto itself. Try it and paste your output for us to see (minus the password of course ;0)) |
||||||||
|
|
|||||||
Here are the results. \\XXX-ADC-03\netlogon\runnas.exe /user:TDOMBROWSKI-XPP\administrator C:\WINDOWS\temp\WindowsXP-KB926139-v2-x86-ENU.exe /quiet /pass:XXXXXXXX |
||||||||
|
|
|||||||
Shawn Just so you know I tried to run the command interactively in dos, with the same results.. It just does not like the /quite switch.. Oh well, I will see if I can figure out another way thanks for the help.. I will check back to see if you had a thought.. thanks again. |
||||||||
|
|
|||||||
hmmm, still don't see those quotes in their proper place - in the output line you posted. What doesn't run quietly from the command line ? This: \\XXX-ADC-03\netlogon\runnas.exe /user:TDOMBROWSKI-XPP\administrator C:\WINDOWS\temp\WindowsXP-KB926139-v2-x86-ENU.exe /quiet /pass:XXXXXXXX Or this: C:\WINDOWS\temp\WindowsXP-KB926139-v2-x86-ENU.exe /quiet === That first command line should look like: \\XXX-ADC-03\netlogon\runnas.exe /user:TDOMBROWSKI-XPP\administrator "C:\WINDOWS\temp\WindowsXP-KB926139-v2-x86-ENU.exe /quiet" /pass:XXXXXXXX |
||||||||
|
|
|||||||
Shawn I think you got it.. I tried what you suggested this morn.. SHELL $runaspath + ' /user:' + @wksta + '\Administrator ' + '"$winpath"' + ' /pass:xxxxxxxx' in $winpath the /quiet was part of it.. that did not work.. I just changed it to the following $runaspath + ' /user:@wksta\administrator ' + '"$Winpath /quiet"' + ' /pass:xxxxxx' where /quiet is appended differently.. so far that has worked on my test machine. I will test it elsewhere.. Again thanks for the help. |
||||||||
|
|
|||||||
VICTORY....... Thanks. |