#197369 - 2010-01-13 03:29 PM
runnas as local admin
|
Marten
Just in Town
Registered: 2010-01-13
Posts: 1
Loc: WI, USA
|
I am trying to get runnas to run as local admin. I have tried just /user:administrator, /user:%computername%\administrator and no joy. Any ideas?
Thanks in advance Mike
Edited by Marten (2010-01-13 03:50 PM)
|
|
Top
|
|
|
|
#197370 - 2010-01-13 04:30 PM
Re: runnas as local admin
[Re: Marten]
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Marten,
Welcome to the board! Man.. It is amazing how these things come up all of the sudden. 
Did you get a chance to look over at the FAQ Forum?
Specfically, Installing an Application as an Admin
Well.. Did some research and it is not real simple.. But, as you read my response you will see how to arrive at a good conclusion.. Please bear with me as this response is a little long as I do some pretty extensive testing..
Hmm.. Let's see here.. We can try runas.. quote:
C:\>runas /? RUNAS USAGE:
RUNAS [ [/noprofile | /profile] [/env] [/netonly] ] /user: program
RUNAS [ [/noprofile | /profile] [/env] [/netonly] ] /smartcard [/user:] 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 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.
Alright, let's try it.. This works.. However, you have to enter in everything manually.. quote:
C:\>runas /profile /env /user:%userdomain%\%username% cmd Enter the password for DOMAIN\KDyer: Attempting to start cmd as user "DOMAIN\KDyer" ...
We know with one of the things with the del command, we can echo through a "y" for a response.. For example - echo y|Del C:\Somefolder\*.*
So, let's take the same logic and try to echo through a password through runas..
This does not work.. That is "echoing" the password through runas.. quote:
echo |runas /profile /env /user:%userdomain%\%username% cmd
C:\>ECHO |runas /profile /env /user:%userdomain%\%username% cmd Enter the password for DOMAIN\KDyer: Attempting to start cmd as user "DOMAIN\Kdyer" ... RUNAS ERROR: Unable to run - cmd 1326: Logon failure: unknown user name or bad password.
This does not work.. Echoing password through runas with a "." as an enter key.. quote:
echo .|runas /profile /env /user:%userdomain%\%username% cmd
This does not work.. quote:
echo |runas /profile /env /user:%COMPUTERNAME%\%username% cmd
This does not work.. Echoing password through runas with a "." as an enter key.. quote:
echo .|runas /profile /env /user:%COMPUTERNAME%\%username% cmd
This does not work.. quote:
runas /noprofile /user:"NT AUTHORITY\SYSTEM" cmd
This does not work.. quote:
echo .|runas /noprofile /user:"NT AUTHORITY\SYSTEM" cmd
Another alternative is SANUR.. http://www.commandline.co.uk/sanur_unsupported/index.html
quote:
Pipe the password 'pa55w0rd' into Runas:- runas /u:domain\username program.exe | sanur pa55w0rd
This does work!! quote:
runas /u:%userdomain%\%username% cmd | sanur
Other alternatives.. http://www.commandline.co.uk/sanur/index.html
I tried to find a copy of the Windows 2000 Resource Kit, but could not find it locally.. You are supposed to be able to use the SU.EXE (switch user, which is also used in the UNIX World).. I also think there is a program called SCHTASKS.EXE in the 2000 Resource Kit as well..
Here is another way to schedule tasks.. ftp://ftp.microsoft.com/reskit/win2000/jt.zip
HTH,
Kent
|
|
Top
|
|
|
|
#212406 - 2017-04-04 09:36 AM
Re: runnas as local admin
[Re: Glenn Barnas]
|
Snickers
Fresh Scripter
Registered: 2017-03-28
Posts: 15
Loc: uk
|
Hi Glenn,
Can i use a scheduled task to run when a student logs onto a windows terminal server from a linux thin client to run a kix script in elevated status to install a printer?
(From post http://www.kixtart.org/forums/ubbthreads...rue#Post197370)
The script works for me but my account is admin. This is the script that I am testing:
;--------Start IF_ELSE.kix--------
If Left(@WKSTA, 1) = "w"
;Delete the printer.
$rc = DelPrinterConnection("PR2-A-E9-17")
;Connect the printer.
$rc = AddPrinterConnection("\\cur-prs\PR2-A-E9-17")
;Set the printer as default.
$rc = SetDefaultPrinter("\\cur-prs\PR2-A-E9-17")
Else
;Do nothing.
EndIf
;-------- end IF_ELSE.kix--------
Edited by Mart (2017-04-04 02:03 PM) Edit Reason: Please use code tags when posting code.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 687 anonymous users online.
|
|
|