function prompt { #check and see if logon server is the same as the computername if ( $env:logonserver -ne "\\$env:computername" ) { #strip off the \\ $label = ($env:logonserver).Substring(2) $color = "Green" } else { $label = "Not Connected" $color = "gray" } Write-Host ("[$label]") -ForegroundColor $color -NoNewline Write (" PS " + (Get-Location) + "> ") }