question

Leon-5680 avatar image
0 Votes"
Leon-5680 asked Leon-5680 commented

Powershell Set-NetAdapter Command trows error

Hey Everyone, My PS Set-NetAdapter command does not work anymore, It worked always, now it stopped working.
I get the following error when trying to run it

 PS C:\Windows\system32> Set-NetAdapter -Name "Ethernet" -MacAddress "B4-2E-99-17-6D-PP"
 Set-NetAdapter : Mindestens einer der an die Methode übergebenen Parameterwerte war ungültig.
 In Zeile:1 Zeichen:1
 + Set-NetAdapter -Name "Ethernet" -MacAddress "B4-2E-99-17-6D-PP"
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : InvalidArgument: (MSFT_NetAdapter...ame = "LeonPC"):ROOT/StandardCimv2/MSFT_NetAdapter)
    [Set-NetAdapter], CimException
     + FullyQualifiedErrorId : MI RESULT 4,Set-NetAdapter
    
 PS C:\Windows\system32>
windows-server-powershell
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Edit: Found it out; Its a invalid MacAddress

0 Votes 0 ·

Hi @Leon-5680 ,

just because of being noisy: It was was the -PP? ;-)


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

1 Vote 1 ·
Leon-5680 avatar image Leon-5680 AndreasBaumgarten ·

Yup, it was the -PP

0 Votes 0 ·

1 Answer

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered Leon-5680 commented

Hello,

Thanks for reaching out.

As per Microsoft guide related to MAC address parameter

Specifies the current MAC address of the network adapter. Dashes are optional as part of the input. Not all network adapters support setting the MAC address. The address passed in is also saved in the network addresses property without dashes.

Example : Set-NetAdapter -Name "Ethernet2" -MacAddress "00-10-18-57-1B-0D"

https://docs.microsoft.com/en-us/powershell/module/netadapter/set-netadapter?view=windowsserver2019-ps

Thank you.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you! I forgot that Mac's can only have A-F / 0-9 Characters.

0 Votes 0 ·