I have some scripts I want to send out to a department of laptops to help configure a new VPN we'll be using. The first script enables Split Tunneling and the other adds and app trigger for mstsc.exe.
Because of how busy the members of this department often are, I'd like to leverage MC to send these scripts to each laptop for me. However, even after adding a snippet to the beginning that should self-elevate the scripts
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$arguments = "& '" +$myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
however, the logs always result in the error that the new VPN connection name cannot be found. Digging into the error, it seems most likely that this is due to the script not actually running as elevated.
Has anyone successfully sent and executed a self-elevating Powershell script through Mobicontrol?