/build/static/layout/Breadcrumb_cap_w.png
07/24/2018 495 views
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

Answer Summary:
1 Comment   [ + ] Show comment

Comments

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

Answer Chosen by the Author

0
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
Answered 07/24/2018 by: Channeler
Red Belt

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

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