Closed Karl-WE closed 1 year ago
Hi Karl,
danke für den Tipp.
Ich habe den Part in den Code eingebaut, aber wenn ich das Script "automatisch" laufen lasse, kommt noch das folgende Meckern. 😬
"Die Datei "C:\WORK\WINDOWS10AND11-NETWORK-DESUBUPTIMIZATION V1.12.ps1" kann nicht geladen werden, da die Ausführung von Skripts auf diesem System deaktiviert ist. Weitere Informationen finden Sie unter "about_Execution_Policies""
Das lässt sich doch innerhalb des Skripts selbst gar nicht umgehen, oder?
Gruss Alex
Hi Karl, dein "auto elevation" Vorschlag habe ich soeben übernommen. Vielen Dank dafür. Gruss Alex
Works great! But it closes the shell after it ran. Can you disable that? So you can see errors and stats.
You can add break or sleep at the end
This would allow the script to run with a right click, disregarding manual elevation
This comes handy in Windows Terminal or Explorer Context Menu run script, both aren't elevated by default.
if (-not (New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{ # Prompt the user to elevate the script $arguments = "& '" + $myInvocation.MyCommand.Definition + "'" Start-Process powershell -Verb runAs -ArgumentList $arguments exit }
your code here