[NTSysADM] RE: More PowerShell help

2016-09-01 Thread James Rankin
s.myitforum.com] On Behalf Of Joseph L. Casale Sent: 01 September 2016 14:15 To: ntsysadm@lists.myitforum.com Subject: [NTSysADM] RE: More PowerShell help Does it have to be a script? You can trivially generate an executable in C# with a manifest to require elevation, given you are using Pow

[NTSysADM] RE: More PowerShell help

2016-09-01 Thread Joseph L. Casale
Does it have to be a script? You can trivially generate an executable in C# with a manifest to require elevation, given you are using PowerShell you can certainly replicate the functionality in C#... jlc From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On Behalf Of

[NTSysADM] RE: More PowerShell help

2016-08-31 Thread Stephen Gestwicki
The easiest way I have found without changing UAC settings was to create a small batch file that I right click on an select "Run as administrator". This is the contents of my batch file: @echo off set ScriptDirectory=%~dp0 PowerShell -ExecutionPolicy Unrestricted -Command "&'%ScriptDirectory%\scri

[NTSysADM] RE: More PowerShell help

2016-08-31 Thread Michael B. Smith
In the PowerShell script itself, check to see if it has an admin token. If it doesn't, then relaunch powershell.exe using Start-Process with -Verb RunAs so that it will have the admin token. In other words, what is shown here: http://stackoverflow.com/questions/7690994/powershell-running-a-comm