I am having trouble installing PowerShell Universal on MacOS. After installing the Universal module successfuly with the -AddToPath parameter, I then run Start-PSUServer. However it error’s out saying it is unable to locate the PowerShell Universal executable.
Can anyone help? I have been looking for more documentation on this install on MacOS and haven’t found anything helpful yet.
Product: PowerShell Universal
Version: 1.4.6
Were you able to get it working? It looks like you can specify the path when you run Start-PSUServer.
I adapted part of the Install-PSUServer code to write a small function to add the server path to the environment PATH variable.
function AddPuServerPathProcessEnv ([string]$FolderPath) {
$folder = 'CommonApplicationData'
if ($IsMacOS) {
$folder = 'ApplicationData'
}
if (-not $FolderPath) {
$ProgramData = [System.Environment]::GetFolderPath($folder)
$FolderPath = [System.IO.Path]::Combine($ProgramData, "PowerShellUniversal", "Server")
}
$CurrentPaths = $env:PATH -split ':'
if ($FolderPath -notin $CurrentPaths) {
$envPath = [Environment]::GetEnvironmentVariable('PATH')
$newpath = $envPath + ":" + $FolderPath
Write-Verbose "Updating PATH environment variable with PU server path" -Verbose
Write-Verbose "PU server path to add: '$FolderPath'" -Verbose
Write-Verbose "New PATH variable: '$newpath'" -Verbose
[Environment]::SetEnvironmentVariable("PATH", $newpath)
}
}