Share via


Anyone experienced a "not recognize cmdlet" after import-module in script?

Question

Thursday, December 15, 2011 11:40 AM

Hello,

I receive the following error message after importing the module WebAdministration in my script on Windows Server 2008 R2 (x64) powershell console:

The term 'Get-WebAppPoolState' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

with the command import-module WebAdministration -verbose, I can see that command Get-WebAppPoolState is well imported.

Do someone get the same error? Do you have any recommandation?

regards,

Tarik

++ T

All replies (2)

Thursday, December 15, 2011 12:35 PM âś…Answered

Hello,

I have the same issue on both powershell console 64 and 32-bit but using the "Import-module WebAdministration -Global" command in my .ps1 script, I solved it.

thank you for your answer anyway.

++ T


Thursday, December 15, 2011 11:54 AM | 1 vote

I  have had problems using the (x64) version of Powershell before.  Try using the one in the regular Powershell path (C:\Windows\System32\WindowsPowershell\v1.0\Powershell.exe.  This is the 64-bit version.  I had this specific problem a while back and using the one under this path resolved the issue.  Here is the reference, although it was different, where I learned to always trust the standard path and not worry too much about the 32-bit version in 64-bit OS'es:

http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/686427c2-9e47-41f9-aff7-7325c450ead0