I have a Powershell error that only happens when I run a script through a Tentacle on one Windows 7 (64-bit) machine.
If I run (as an example):
Get-WebSite -Name “Default Web Site”
I get the following error:
ERROR: Get-WebSite : Could not load file or assembly 'Microsoft.IIS.PowerShell.Framework' or one of its dependencies. The system cannot find the file specified.
However, if I run the same through the Powershell.exe it works correctly. I assumed that there was something I needed to do to make the custom powershell host that the tentacle uses pick up the correct version.
Finally, out of desperation I tried some other commands and got to the point where I had the following (ridiculous) script:
Get-WebSite -Name "Default Web Site"
Get-WebSite -Name “Default Web Site” #yes, it is the same line - not a typo!
And, guess what?! The first “Get-WebSite” fails with the FileNotFoundException and the second one works fine! Is it a timing issue with loading the assemblies in the Powershell Host? And, do you have a workaround for this?
I am using version 126.96.36.1994.