March 3, 2016 at 8:27 am #36002
I had previously setup PSWA 4.0 that executed a profile.ps1 script at logon to resize the console, add snapins, and drop the user into a UNC network location where the scripts are contained. I upgraded to PS 5.0 on Friday and now when users login, all elements of the script work EXCEPT Set-Location. I have tried to cd to a local path instead of UNC, which also did not work. There are no errors or warnings. If I execute the startup script after I am already logged in to the PSWA, it executes properly and changes to the UNC path. Has anyone else noticed this?
March 3, 2016 at 10:38 am #36010
I've yet to put PowerShell 5.0 on a PSWA server. That said, in a situation such as this, I'd check the event logs. Check the Windows PowerShell log, as well as Microsoft-Windows-PowerShell and especially Microsoft-Windows-PowerShellWebAccess. I assume that when you say "a profile.ps1 script," that you're referring to a StartUpScript .ps1 file. I'd be tempted to add a line (below) to the top of the StartUpScript file that searched for the Set-Location command. Maybe even add it in between each of the other things your .ps1 file is successfully completing.
"Set-Location Command: $([bool](Get-Command -Name Set-Location))"
March 4, 2016 at 2:15 pm #36097
Thanks for your reply Tommy. First let me say that you actually helped me setup my PSWA (indirectly) after I stumbled upon your other solution for https://powershell.org/forums/topic/powershell-web-access-vs-ad-cmdlet/. I actually ended up just making a separate PS Config for each user on my PSWA (about 5 users) and then set each one with -RunAsCredential, and they are now able to run both AD and Quest AD cmdlets in PSWA without error.
When I added the "Set-Location Command: $([bool](Get-Command -Name Set-Location))" command to the startupscript, I can no longer sign in and it errors out. I modified it and just simply added "Get-Command Set-Location" the startup, and I receive no output, as if it doesn't exist at startup. However, once the startup finishes and I type the command manually, it shows as expected.
It is pretty strange, and it almost seems like the command is simply not there at logon, but is there after logon. I have looked through the logs and was unable to find anything obvious (there were no errors, and few warnings) Do you have any other thoughts? I am also wondering if a workaround like adding set-location or cd to the pssc file.
March 7, 2016 at 9:02 am #36171
Just as an update, I tried to completely uninstall PSWA and reinstall in case something was added to the install feature in Posh 5.0, no luck. I also tried to add "Import-Module Microsoft.PowerShell.Management" since set-location is a part of that module in case it was loading that immediately during startup and still no luck.
I even went as far as putting the set-location command into another script and then calling that script at the end of my startup script, also with no luck.
You must be logged in to reply to this topic.