Universal.psm1
Import-Module "$PSScriptRoot\Universal.Cmdlets.dll" [UniversalAutomation.AssemblyResolver]::Bind() function Resolve-Variable { [CmdletBinding()] param($Name) $PSCmdlet.GetVariableValue($Name) } function Start-PSUServer { param( [Parameter()] $ExecutablePath = "Universal.Server.exe", [Parameter()] $ListenAddress ) $Command = Get-Command $ExecutablePath -ErrorAction SilentlyContinue if ($null -eq $Command) { throw 'Unable to locate the Universal Server executable. You can use Install-PSUServer to download the latest version. Use the -UpdatePathVariable parameter to add the installation directory the the PATH.' } if ($ListenAddress) { $Env:Kestrel__Endpoints__HTTP__Url = $ListenAddress } Start-Process -FilePath $ExecutablePath } function Install-PSUServer { param( [Switch]$UpdatePathVariable, [string]$Path ) $platform = "win-x64"; if ($PSVersionTable.Edition -eq 'Core') { if ($IsLinux) { $platform = "linux-x64" } else { $platform = "osx-x64" } } $Version = (Invoke-WebRequest https://imsreleases.blob.core.windows.net/universal/production/version.txt).Content Invoke-WebRequest "https://imsreleases.blob.core.windows.net/universal/production/$version/Universal.$platform.$Version.zip" -OutFile ".\Universal.$version.$platform.zip" Expand-Archive -Path ".\Universal.$Version.$platform.zip" -DestinationPath $Path Remove-Item ".\Universal.$Version.$platform.zip" -Force $Scope = 'User' if ($platform -eq 'win-x64' -and ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { $Scope = 'Machine' } if ($UpdatePathVariable) { $envPath = [Environment]::GetEnvironmentVariable('PATH', $Scope) $newpath = $envPath + ";" + $Path [Environment]::SetEnvironmentVariable("PATH", $newpath, $Scope) $Env:Path += ";" + $newpath } } # SIG # Begin signature block # MIIXvwYJKoZIhvcNAQcCoIIXsDCCF6wCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4D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EJBjGCAfgwggH0AgEBMHIwXjELMAkGA1UEBhMCVVMxHTAbBgNVBAoTFFN5 # bWFudGVjIENvcnBvcmF0aW9uMTAwLgYDVQQDEydTeW1hbnRlYyBUaW1lIFN0YW1w # aW5nIFNlcnZpY2VzIENBIC0gRzICEA7P9DjI/r81bgTYapgbGlAwCQYFKw4DAhoF # AKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTIw # MDczMDE3MjU0NVowIwYJKoZIhvcNAQkEMRYEFCSTaevTa6zIt+jVddZLOyqaoLn/ # MA0GCSqGSIb3DQEBAQUABIIBAIdCNDDCoExurEu9RuDx6VLHpWITREmtH4jMiYgY # LUS1mlzMVg/LwfA58rn3dlQQw2ZkMc82c1qzLZbXqULMyYZWiw0syq+KsWEF3h/n # 19JGVqZQhSGNzfkK3VxLfQqutznTYOANvqGxhARfZ+x/Tsx1BfuaL16lLBMW0FJZ # 6DdHW3E1E+U+u673MvwCQDNAv99sHRq2SdHcCNuzsr2AEoATGIVLaIsy9WS96ZTY # Rat1T1hGikE331p2aqJ34xfNLvdPAIZNSz83j/rboI2krp1Raa9gmTKL70b7d4OA # UM6Mc4TmsWvwYNwVRx/o90225CD/Zt/oqoLTp2FfYXbM9q8= # SIG # End signature block |