Skocz do zawartości
asusek147

Powershell podniesienie uprawnień

Rekomendowane odpowiedzi

Potrzebuję kodu żrudłowego który będzie dodany w skrypcie Powershell jego zadaniem będzie podniesienie uprawnień co spowoduje uruchomienie skryptu jako administrator

 

będę wdzięczny za pomoc

Udostępnij tę odpowiedź


Odnośnik do odpowiedzi
Udostępnij na innych stronach

Potrzebuję kodu żrudłowego który będzie dodany w skrypcie Powershell jego zadaniem będzie podniesienie uprawnień co spowoduje uruchomienie skryptu jako administrator

 

będę wdzięczny za pomoc

RunAs może?

 

RUNAS USAGE:

RUNAS [ [/noprofile | /profile] [/env] [/savecred | /netonly] ]
       /user:<UserName> program

RUNAS [ [/noprofile | /profile] [/env] [/savecred] ]
       /smartcard [/user:<UserName>] program

RUNAS /trustlevel:<TrustLevel> 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 7 Home or Windows 7
Starter Editions
                    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
  /showtrustlevels  displays the trust levels that can be used as arguments
                    to /trustlevel.
  /trustlevel       <Level> should be one of levels enumerated
                    in /showtrustlevels.
  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:  /profile is not compatible with /netonly.
NOTE:  /savecred is not compatible with /smartcard.

 

To będzie lepsze

psexec -u [użytkownik] -p [hasło] "notepad.exe" 

Edytowane przez Atak_Snajpera

Udostępnij tę odpowiedź


Odnośnik do odpowiedzi
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się

  • Ostatnio przeglądający   0 użytkowników

    Brak zarejestrowanych użytkowników przeglądających tę stronę.

×
×
  • Dodaj nową pozycję...