/build/static/layout/Breadcrumb_cap_w.png

Powershell Command missing in KBE

I've built a K2 SDA pre-install script that gets the client computer's MAC address via the Powershell command "Get-NetAdapter".

This script works perfectly when I run it manually on a Windows system. But when the KBE runs it, I get "The term 'Get-NetAdapter' is not recognized as the name of a cmdlet, function, script file, or operable program".

Thinking maybe my one-version-back build of Windows didn't have a recent enough Powershell, I built a new KBE with the most recent 1803 build of Windows, and it also fails with the same message.

Why would a standard Powershell command not be found in a KBE run?

Thanks!

--
Kent


1 Comment   [ + ] Show comment
  • So, to watch what was happening in my script, I added a "Write-Out" command to a log file, and this cmdlet also is not found in the KBE's version of Powershell.

    What?! This is basic Powershell stuff! What good is Powershell in the KBE if it's crippled? - kentwest 6 years ago

Answers (1)

Answer Summary:
Posted by: Channeler 6 years ago
Red Belt
0

Top Answer

Hello

I believe this is a Windows PE 10 limitation, not related to the Powershell version, or  KACE tools:

See:

https://social.technet.microsoft.com/Forums/windowsserver/en-US/e84f87a6-f311-47b6-b201-11f7085546b9/powershell-netip-cmdlets-on-winpe?forum=winserverpowershell

https://social.technet.microsoft.com/Forums/office/en-US/2b05be74-4189-49c7-b0be-8ca4466a530b/winpe10-powershell-modules-and-user-interface?forum=win10itprosetup

https://social.technet.microsoft.com/Forums/windows/en-US/2489d01b-9116-4fc7-b33a-c966b59044bb/limited-powershell-functionlatiy-in-winpe?forum=w8itproinstall

Pre-Install tasks are using Windows PE to execute commands, I suggest you to go to your KBE, open CMD and go to
X:\Windows\System32\WindowsPowershell\

and type   Get-Module -listavailable

and it should list all modules, I did it here, and get-netadapter is not there, unfortunately

Comments:
  • Wow, Who'da thunk?

    I've been trying to like Microsoft/Windows a little better lately (after years of absolutely despising them), and was doing a little better, but this sort of thing sets me back.

    Arg.

    I was able to find a work-around for the Get-NetAdapter, though:

    $MY_MAC = Get-CimInstance win32_networkadapterconfiguration | foreach { $_.MacAddress }

    And "Write-Host" works, so I can use that as a substitute (sort of, like using a heavy boot heel as a hammer) for "Write-Out".

    I very much appreciate your response; that explains it, and puts the blame on Microsoft rather than KACE.

    Thanks! - kentwest 6 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ