I have the following Powershell script:
# Check if the script is running as admin
$IsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
if (-not $IsAdmin) {
# Display an error message and exit
Write-Output "Dieses Programm muss als Administrator ausgeführt werden. Bitte Rechtsklicke diese datei und wähle 'Als Administrator' ausführen."
Start-Sleep -Seconds 50
break
}
$PortName = Read-Host -Prompt "Gib deine Druckeradresse ein"
Invoke-WebRequest -Uri "https://dl.konicaminolta.eu/de?tx_kmdownloadcentersite_downloadproxy%5bfileId%5d=7f86746b8a2082a5152d3dd65a48292d&tx_kmdownloadcentersite_downloadproxy%5bdocumentId%5d=135985&tx_kmdownloadcentersite_downloadproxy%5bsystem%5d=KonicaMinolta&tx_kmdownloadcentersite_downloadproxy%5blanguage%5d=DE&type=1558521685" -OutFile "C:\printer.zip"
Expand-Archive -Path "C:\printer.zip" -DestinationPath "C:\printerAksa"
pnputil.exe /add-driver "C:\printer\UPD4PCL6Win81P_2101MU\driver\x64\PCL6\KOBxxK__01.inf" /install
Add-PrinterDriver -Name “KONICA MINOLTA Universal V4 PCL”
Add-Printer -PortName $PortName -DriverName "KONICA MINOLTA Universal V4 PCL" -Name "Printer"
Remove-Item -Path "C:\printer.zip" -Force
Remove-Item -Path "C:\printer" -Recurse -Force`
It is meant to install the printers for our school because at the moment the school's solution is to install is manually, but many people aren't tech savvy enough to do that, even with a step-by-step guide. So i created this script in which one only has to enter their own printer address provided by the school and the rest is done for them. The problem now is that you cant really just share PowerShell scripts, because you'd have to change a policy to execute it (at least to my knowledge). What I tried is converting it to an exe file using PS2EXE which worked but when others downloaded it, Windows blocked the download as it was identified as a virus. So here is the Question: How do I bring my little program to others from the school without it getting flagged? Maybe there is even a completely different approach than mine to the problem altogether. Thanks for your suggestions!