I am trying to run powershell script version 5.1 in windows 2012R2
powershell.exe -NoProfile D:\test2.ps1 on the powershell command console (I do not the script session using any profile on the system)
Now I am checking in the test.ps1 script what profile is loaded in test.ps1 script
$profile
I get output C:\Users\XXXXX\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Any thought why any profile start up in my session.
$Profile
lists the one that would be loaded, not the one that is loaded. remember that it will list a file that does not exist. [grin] – Lee_Dailey