Hi,
I am really trying to go more down the PowerShell route, I have a script below to configure network adapter settings, but with all the searching I have done I still have to use WMI for some bits. is there any better way to do what I have scripted? is it in its simplest form?
#set the prefix for the private cluster adapters
$PrivatePrefix=24
#set the MTU (Jumbo Frames)
$MTU="9000"
#MAC of ISCSI DATA A1 – B1, located on Port 1 of 10gB 570SFP+ NIC
$macToFind = 'A0-44-3D-77-3A-DD'
#store the current name in a variable
$nicName = Get-NetAdapter | Where { $_.MacAddress -eq $macToFind } | Select -ExpandProperty Name
Set-NetIPInterface -InterfaceAlias $nicName -Dhcp Disabled
New-NetIPAddress -InterfaceAlias $nicName -IPAddress 10.10.10.1 -PrefixLength $PrivatePrefix
#Set-DnsClientServerAddress -InterfaceAlias $nicName -ServerAddresses $DNSIP
Set-NetAdapterAdvancedProperty -Name $nicName -RegistryKeyword "*JumboPacket" -RegistryValue $MTU
#disable bindings, to see a list of bindings use Get-NetAdapterBinding -InterfaceAlias $nicName
Disable-NetAdapterBinding -Name LAN -ComponentID ms_msclient, ms_pacer, ms_server, ms_rspndr, ms_lltdio
$adapter=(gwmi -query "select * from win32_networkadapter where netconnectionid= '$nicName'").deviceid
([wmi]"\\.\root\cimv2:Win32_NetworkAdapterConfiguration.Index=$adapter").SetTcpipNetbios(2)
([wmi]"\\.\root\cimv2:Win32_NetworkAdapterConfiguration.Index=$adapter").SetDynamicDNSRegistration($false)
#rename the current named NIC to a new name
Rename-NetAdapter -Name $nicName -NewName "ISCSI DATA A1–B1"Thanks for any help
Steve