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".
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
Answers (1)
Answer Summary:
Please log in to answer
Posted by:
Channeler
6 years ago
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
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
What?! This is basic Powershell stuff! What good is Powershell in the KBE if it's crippled? - kentwest 6 years ago