Previous Next

Thread: IS add-pssnapin for IIS provider always required??

Last post 04-15-2008 6:34 PM by JeongHwan. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 04-15-2008, 2:13 PM

    • ma_khan
    • Top 25 Contributor
    • Joined on 03-16-2008, 8:26 PM
    • Posts 276
    • ma_khan

    IS add-pssnapin for IIS provider always required??

    Hello Ppl,

    Is it always required to do a add-pssnapin for PS IIS Provider everytime I start a new session of Windows PowerShell.

    Everytime I try any cmdlet for PS IIS provider it throws as error, but, once I do a add-pssnapin  for the IIS provider everything gets into place and all is well..

    what am I missing here???  

    Regards,
    MA Khan
    http://www.iisworkstation.com

    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
  • 04-15-2008, 2:30 PM In reply to

    • JeongHwan
    • Top 150 Contributor
    • Joined on 12-14-2004, 11:43 AM
    • Redmond, WA
    • Posts 18
    • JeongHwan

    Re: IS add-pssnapin for IIS provider always required??

    No, you aren't missing anything.

    If you started Powershell prompt or shell without using the short-cut menu which is created by the IIS Powershell Provider setup program, you have to add the IIS snap-in to your shell using the add-pssnapin cmdlet. If you see the property of IIS Powershell Management console short-cut menu, it would look like this. 

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -psconsolefile "C:\Program Files\IIS\PowerShellProvider\IIsConsole.psc1" -NoExit -command set-location IIS:\;clear-host

    Actually it does exactly the same thing of the cmdlet execution of "add-pssnapin IIsProviderSnapIn". The short-cut menu is made for user's convenience in order not to need to execute the add-pssnapin command everytime when the Powershell prompt is started.

    Jeong Hwan Kim
  • 04-15-2008, 2:50 PM In reply to

    • ma_khan
    • Top 25 Contributor
    • Joined on 03-16-2008, 8:26 PM
    • Posts 276
    • ma_khan

    Re: IS add-pssnapin for IIS provider always required??

    JeongHwan,

        Yeah just noticed that... but is it not possible that we can add the IIS provider permanently into Windows PowerShell so that we dont have to always do a add-pssnapin ...Of course there is always the IIS PowerShell Managment Console... but just a query :D
     

    Regards,
    MA Khan
    http://www.iisworkstation.com

    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
  • 04-15-2008, 4:26 PM In reply to

    • JeongHwan
    • Top 150 Contributor
    • Joined on 12-14-2004, 11:43 AM
    • Redmond, WA
    • Posts 18
    • JeongHwan

    Re: IS add-pssnapin for IIS provider always required??

    Hi ma_khan, 

    I had the same question and contacted the Powershell team in Microsoft but the answer was that there is no way to add IIS Provider snapin permanently.

    JeongHwan

    Jeong Hwan Kim
  • 04-15-2008, 5:10 PM In reply to

    Re: IS add-pssnapin for IIS provider always required??

    You can do this by adding the line Add-PSSnapIn IIsProviderSnapIn to your profile.ps1 script.  This script is executed each time you start a new PowerShell session (like a .bashrc or .bash_profile script in *nix land). 

    The script doesn't exist by default, so you need to create a new PowerShell script called profile.ps1 in My Documents\WindowsPowerShell.  This is just like any other PowerShell script, so you can fill it with all sorts of useful things.  For example, I have another script called profile_alias.ps1 that sets up some useful aliases in my PowerShell session (e.g., edit -> text editor) which I dot-source from my profile.ps1 script.

    Hope that helps

    Alastair
     

  • 04-15-2008, 6:34 PM In reply to

    • JeongHwan
    • Top 150 Contributor
    • Joined on 12-14-2004, 11:43 AM
    • Redmond, WA
    • Posts 18
    • JeongHwan

    Re: IS add-pssnapin for IIS provider always required??

    Thanks Alastair. You gave better answer than mine. :-)

    Jeong Hwan Kim
Page 1 of 1 (6 items)
Page view counter