locked
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:"

    $drive.Put()
    ***********

    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

Answers

  • 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.

    • Proposed as answer by Mike Laughlin Thursday, March 26, 2015 8:20 PM
    • Marked as answer by Boe ProxMVP Sunday, July 26, 2015 3:29 AM
    Thursday, March 26, 2015 8:04 PM

All replies

  • Hi,

    The ConfigMgr PowerShell forum is here:

    In this particular case forwarding him to the ConfigMgr SDK and PowerShell forum was not the right thing to do, this particular issue has nothing to do with ConfigMgr, there is a problem with his script.
    Monday, March 23, 2015 10:03 PM
  • In this particular case forwarding him to the ConfigMgr SDK and PowerShell forum was not the right thing to do, this particular issue has nothing to do with ConfigMgr, there is a problem with his script.

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

    Don't retire TechNet! - (Don't give up yet - 13,225+ strong and growing)

    Monday, March 23, 2015 10:10 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.

    • Proposed as answer by Mike Laughlin Thursday, March 26, 2015 8:20 PM
    • Marked as answer by Boe ProxMVP Sunday, July 26, 2015 3:29 AM
    Thursday, March 26, 2015 8:04 PM
  • I'm not the enemy here Mike.
    My apologies, that response came off harsher than I intended.

    Don't retire TechNet! - (Don't give up yet - 13,225+ strong and growing)

    Thursday, March 26, 2015 8:20 PM
  • No worries, we've all had hard days at work :)
    Thursday, March 26, 2015 8:28 PM