Hi all
I am trying to write a script that will go through the SYSTEM\\CurrentControlSet\\Control\\Class reg key on remote computers to find the CLSID or GUID of the network card and based off of that tell me what the *JumboPacket Value is set to. I know most of you would say to use netsh, unfortualtey that doesnt dispaly the correct info in a VM.
The hive typically looks like this
HKLM\SYSTEM\\CurrentControlSet\\Control\\Class\{45s45d45-54545454-sdfsdfsf-sdfs}
under the GUID (the above one is bogus) you would have several subkeys going from 0000 to 0011(or less), in one of the 00xx keys you would have a value of *JumboPacket and the value data would reveal what it is set to.
I took a stab at this however it looks like I am doing something wrong, see below
Function Get-Registry()
{
#Param($MachineName = ".")
#$MachineName = "abc123"
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $MachineName)
$RegKey= $Reg.OpenSubKey("SYSTEM\\CurrentControlSet\\control\\class")
$SubKeyArray = $Regkey.GetSubKeyNames()
ForEach ($SubKey in $SubKeyArray)
{
$NewReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $MachineName)
$NewRegKey= $NewReg.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Class\\$SubKey")
$RegKeyValues = $NewRegKey.GetValueNames()
ForEach ($RegKeyValue in $RegKeyValues)
{
$RegKeyValueOutput = $NewRegKey.GetValue($RegKeyValue)
#Write-Host $MachineName `t `t $RegKeyValue `t `t `t `t `t $RegKeyValueOutput
If ($RegKeyValue -like "Class" -and $RegKeyValueOutput -eq "Net")
{
# Write-Host $server `t `t `t `t `t $SubKey `t `t `t `t `t `t $RegKeyValue `t `t `t `t `t $RegKeyValueOutput
$NewReg2 = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $MachineName)
$NewRegKey2= $NewReg2.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Class\\$SubKey")
$SubKeyArray2 = $newRegkey2.GetSubKeyNames()
ForEach ($SubKey2 in $SubKeyArray2)
{
$NewReg3 = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $MachineName)
$NewRegKey3= $NewReg3.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Class\\$SubKey\\$SubKey2")
$RegKeyValues3 = $NewRegKey3.GetValueNames()
ForEach ($RegKeyValue3 in $RegKeyValues3)
{
$RegKeyValueOutput3 = $NewRegKey3.GetValue($RegKeyValue3)
#$RegKeyValueOutput3
If ($RegKeyValue3 -eq "*JumboPacket")
{
#Write-Host $server `t `t `t `t `t $SubKey2 `t `t `t `t `t `t $RegKeyValue3 `t `t `t `t `t $RegKeyValueOutput3
}
}
}
}
}
}
}
$Servers = @("abc123","xyz123","def456")
ForEach ($Server in $Servers)
{
any and all help is appreciated
Magnus