Is it possible to switch from normal mode to administrator mode in command line? I don't want to open command line by right clicking and selecting 'run as administrator'. Thanks
I would like to execute powershell script with administrative privileges as it requires IIS a. I'm asking because from what I know, CA Release Automation always.
The answer is no. The 'full administrative token' is associated with an .EXE when it's launched. You need to start a new CMD.EXE to get full-admin privs. To make UAC a bit more bearable, you can enable 'auto-admin approval' through group policy.
You can't really 'switch' between the two modes, but there are some 3rd partytools that let you launch programs from the command line in the elevated admin. Provided you drop them into a working path, you could, for example, use 'elevate cmd' from the start menu or from an existing command prompt to start a new session in the elevated mode.
if you are in visual studio code, in configuration you can add this:
madwyattmadwyatt
Not the answer you're looking for? Browse other questions tagged command-line-interfacepowershellwindows-command-prompt or ask your own question.
Okay, this is not actually a virtualization related post – but is a purely about PowerShell. None the less – it is something that I use quite often when scripting Hyper-V – so I thought I would post it here.
The long and the short of it is that, as a general rule, I always leave UAC enabled on Windows and never run as Administrator by default. But I do have scripts that need to run as administrator from time to time.
Rather than launching PowerShell “as Administrator” (which would result in me running other scripts as administrator – because it would be convenient) I have put together the following chunk of script:
This means that when you run the script in question – a new window will be opened “as Administrator” (with an appropriate prompt).