Powershell Script in WinPE "Property cannot be found" problem RRS feed

  • Question

  • Hi Im trying to run the following powershell script in WinPE while doing an SCCM OSD and am getting an error. The script is as follows:


    $drive = gwmi Win32_Volume | where {$_.DriveLetter -eq ""}

    $drive.DriveLetter = "Z:"


    The script is supposed to select the volume that has a blank drive letter then sets it to Z:.

    When running the second line I get an error "The property 'DriveLetter' cannot be found on this object"

    Any ideas??

    Monday, March 23, 2015 8:09 PM


  • Which they will be much better equipped to handle. Do you have anything constructive to add?

    Ok, the problem is that he's filtering against "", whereas he should be filtering against $null.

    I personally believe this is a scripting question and not at all related to ConfigMgr. If he hadn't mentioned the fact that he's trying to run it on WinPE as part of an OSD deployment using SCCM people would have taken the time to look at why his script is failing rather than pass the issue along.

    I know you're more than capable of getting to the bottom of the problem with his script in less than 2 minutes, why spend that same time bouncing him around like a ping pong ball delaying the OP getting answers?

    Anyone in the ConfigMgr forum could have simply asked "Does your script run successfully in full OS? No? Then it's a scripting problem, go to this forum instead...", but that would get us nowhere. I'm not the enemy here Mike.

    Thursday, March 26, 2015 8:04 PM

All replies