Ho scritto uno script PowerShell che installa e avvia alcuni servizi. Funzionerà solo se lo script viene eseguito come amministratore. C'è un modo per forzare uno script ad avere questi privilegi?Forza uno script PowerShell da eseguire come amministratore
5
A
risposta
8
Nel caso si utilizza PowerShell V2 È inoltre possibile effettuare le seguenti operazioni:
Start-Process "$psHome\powershell.exe" -Verb Runas -ArgumentList '-command "Get-Service"'
Questo sarebbe eseguire "Get-Service" come amministratore, è possibile sostituirlo con lo script.
+1
Ha funzionato. Grazie –
0
Si potrebbe guardare la risposta a this question. Ti permette di forzare qualcosa da eseguire come un altro account.
Problemi correlati
- 1. Build TFS: eseguire uno script PowerShell come amministratore
- 2. Come eseguire uno script PowerShell da SSIS
- 3. Come eseguire uno script PowerShell da un file batch
- 4. Come eseguire a distanza uno script remoto elevata in PowerShell
- 5. Come eseguire uno script PowerShell come un lavoro in Jenkins
- 6. Come ottenere Hudson CI per eseguire uno script PowerShell?
- 7. Come eseguire uno script SQL Plus in PowerShell
- 8. Come eseguire uno script PowerShell disponibile nella macchina remota?
- 9. Come eseguire uno script PowerShell senza visualizzare una finestra?
- 10. Come eseguire uno script .sql da bash
- 11. Come eseguire uno script python da java?
- 12. Come eseguire vbs come amministratore da vbs?
- 13. Come accedere all'output di uno script PowerShell?
- 14. Come si eseguono script PowerShell senza diritti di amministratore?
- 15. Esegui PowerShell come amministratore da C#
- 16. Eseguire PowerShell-Script dall'applicazione C#
- 17. Chiamare uno script PowerShell in una nuova istanza di PowerShell pulita (da un altro script)
- 18. Come eseguire sqlcmd da powershell?
- 19. Come faccio a richiamare sc create da uno script PowerShell
- 20. Elevare gli script Powershell
- 21. Esecuzione di uno script Powershell in Fake
- 22. Come eseguire un processo come non amministratore da una console PowerShell elevata?
- 23. Come eseguire un comando nel terminale da uno script Python?
- 24. come demonizzare uno script php da eseguire con upstart
- 25. Come eseguire uno script batch (file .bat) da eclissi
- 26. Come eseguire un AppleScript da uno script Python?
- 27. Come posso eseguire uno script PHP da Java?
- 28. Come eseguire i comandi SVN da uno script Python?
- 29. Eseguire il file di script SQL da PowerShell
- 30. Eseguire script PowerShell sul PC remoto
http://stackoverflow.com/questions/1566969/showing-the-uac-prompt-in-powershell-if-the-action-requires-elevation – dugas