# WinPE and Powershell Scripts

**URL:** <https://forums.powershell.org/t/winpe-and-powershell-scripts/14455>\
**Category:** PowerShell Help\
**Created:** [May 30, 2020, 7:04am UTC](https://forums.powershell.org/t/winpe-and-powershell-scripts/14455 "2020-05-30T07:04:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rich1var](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@rich1var](https://forums.powershell.org/u/rich1var)\
**Post date:** [May 30, 2020, 7:04am UTC](https://forums.powershell.org/t/winpe-and-powershell-scripts/14455/1 "2020-05-30T07:04:05Z")

</div>

Hi all,

New to the forums but hope I am okay to ask a question. I am trying to run powershell in a bootable WinPE. I can load powershell and modify the file structure. I have tested the scripts on my developer machine but cant get them to run within WinPE. The Script I am trying to run is get-windowsautopilotinfo -online.

I have copied the script to the WinPE system, tried with set-executionpolicy bypass

tried with .\ before the file name

I do get errors relating to the term (FILENAME) is not reconized as the name of a cmdlet, function, script file…

I have also copied over my devs workstation powershell scripts folder but no joy.

Any ideas?

Thanks

Rich

---

<div class="post-metadata">

**Author:** ![js2010](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@js2010](https://forums.powershell.org/u/js2010)\
**Post date:** [May 30, 2020, 8:47am UTC](https://forums.powershell.org/t/winpe-and-powershell-scripts/14455/2 "2020-05-30T08:47:31Z")

</div>

What is the exact error message? Note that winpe doesn’t have all the wmi classes that full blown windows does.

---

<div class="post-metadata">

**Author:** ![rich1var](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@rich1var](https://forums.powershell.org/u/rich1var)\
**Post date:** [May 31, 2020, 5:20am UTC](https://forums.powershell.org/t/winpe-and-powershell-scripts/14455/3 "2020-05-31T05:20:50Z")

</div>

Hi JS,

The error I am currently trying to sort is the below

If the image wont show URL below

> **[error](https://ibb.co/nckLbzL)**
>
> Image error hosted in ImgBB

Thanks,

Rich

&nbsp;

---

<div class="post-metadata">

**Author:** ![js2010](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@js2010](https://forums.powershell.org/u/js2010)\
**Post date:** [May 31, 2020, 8:42am UTC](https://forums.powershell.org/t/winpe-and-powershell-scripts/14455/4 "2020-05-31T08:42:58Z")

</div>

Yep, the namespace of that wmi class isn’t there in winpe.

---

<div class="post-metadata">

**Author:** ![rich1var](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@rich1var](https://forums.powershell.org/u/rich1var)\
**Post date:** [May 31, 2020, 2:33pm UTC](https://forums.powershell.org/t/winpe-and-powershell-scripts/14455/5 "2020-05-31T14:33:38Z")

</div>

Thanks for the reply, I have looked on google and assume that there is no way to add this in? My goal was to try and automate the upload of machine hash ID’s to autopilot using a bootable USB drive. The smallest OS I could find was WinPE ☹

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [May 31, 2020, 5:32pm UTC](https://forums.powershell.org/t/winpe-and-powershell-scripts/14455/6 "2020-05-31T17:32:25Z")

</div>

Are you an OEM or reseller? Everything I see says this needs to be done in windows 10. But it also seems it’s either handled by the vendor or management platform such as intune or SCCM. The doc says specifically the manual process should be for testing only.

> **[Manually register devices with Windows Autopilot](https://docs.microsoft.com/en-us/mem/autopilot/add-devices)**
>
> Learn how to manually add devices to Windows Autopilot.

---

<div class="post-metadata">

**Author:** ![rich1var](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@rich1var](https://forums.powershell.org/u/rich1var)\
**Post date:** [May 31, 2020, 6:31pm UTC](https://forums.powershell.org/t/winpe-and-powershell-scripts/14455/7 "2020-05-31T18:31:50Z")

</div>

Hi Doug,

Reseller. I have got the script to work now but had to ditch the bootable media for now. Running it via MDT for the most part.

Thanks,

Rich

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:29pm UTC](https://forums.powershell.org/t/winpe-and-powershell-scripts/14455/8 "2024-05-16T20:29:26Z")

</div>

Closed on May 16, 2024, 8:29pm UTC


