[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $scriptsPath = "C:\Program Files\WindowsPowerShell\Scripts" $scriptName = "Get-AutopilotDiagnosticsCommunity.ps1" $scriptPath = Join-Path -Path $scriptsPath -ChildPath $scriptName Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned -Force Install-Script -Name Get-AutopilotDiagnosticsCommunity -Scope AllUsers -Force Set-Location -Path $scriptsPath if (-not (Test-Path -Path $scriptPath)) { throw "Could not find $scriptName in $scriptsPath after installation." } & $scriptPath