We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

View Complete Thread
  • Re: 'Object reference not set to an instance of an object' error in IIS Powershell

    Jun 04, 2009 01:46 PM|sergeia|LINK

    Mike, you are doing great, but something is still missing here. I still cannot reproduce this issue. And I don't see that ItemExists (that you have in your stack trace) is getting called during processing of new-webvirtualdirectory.

    Let's start full scale attack on this. Please provide answers to following questions:

    1. Which version of PowerShell are you using? Is it version 1 or version 2?

    2. Please describe your setup in full details, you could use any names, I am interested in 'topology': which share is used for configuration, which share is used for parent site home path, which share is passed as home for new vdir?

    3. Make sure you could see the site and folder under it. Run 'dir iis:\sites' and 'dir iis:\sites\parentSite' -- there should be no errors.

    4. Make sure you could see home folder for new vdir. For this share please run 'dir \\machine\share' -- there should be no errors.

    5. Please provide full command line you are using for new vdir, including prompt, like 'PS C:\ #> new-webvirtualdirectory -site testSite -name shared2 -physicalpath \\sergeia-dev32\config'.

    6. After you get an error, please type '$StackTrace' and show me output from it. $StackTrace is PowerShell global variable that is shortcut for $error[0].Exception.StackTrace, and contains managed stack trace for the last error that happened. Previous one will be in $error[1], etc.