header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Need Help Using .Net Remote Registry Manipulation
Last Post 09 Nov 2010 04:56 PM by Mark E. Schill. 5 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
EdmmUser is Offline
New Member
New Member
Posts:9
Avatar

--
18 Oct 2010 12:31 PM
    I need to change FlowControl Settings on 300 Servers. and this are a mixture of Dell r610; HP dl145 and IBM e326 servers and they all have dual Nics.

    #Settings are subkeys under $key, I am trying to get all Nic cards set with *Flowcontrol = Auto Reg_SZ = 2147483648

    $Key = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}", $true 

    #Subkeys that have the Nic flow control Values below $Key. 0000
    0001
    0002
    0003
    0004
    0005
    0006
    0007
    0008
    0009
    0010
    0011 Properties
     
    I need to enumerate under $key and look for DriverDesc -eq to Broadcom*, hp*  after w/c I can run

    $type = [Microsoft.Win32.RegistryHive]::LocalMachine
    $regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($type, '$strcomputer')
    $regKey = $regKey.OpenSubKey($key)
    $strVal = $regkey.GetValueNames() | where {$_ -eq "*FlowControl"}

    # if I was looking for specific subkey 006 or 007 under $key I can run this,
     
    if ($strVal -ne $null) {
    $regKey.SetValue('*FlowControl','2147483648','String')}

    #problem is that the Nic Setting can be in any of this subkey so i really need to look for where the Nic Desc are and then do something like this against that subkey.

    Foreach ($strvals in $strval)
    $regKey.SetValue('*FlowControl','2147483648','String')}

    I can't figure out the method to do like a reg query /s through  .NET Powershell Registry

    If my explanation is confusing, please just let me know.
    Thanks
    edm365f31User is Offline
    Basic Member
    Basic Member
    Posts:100
    Avatar

    --
    19 Oct 2010 06:53 AM
    I've called .Net Reg class, did functions, if and for loops allover in my script, then I found this!!
    http://code.msdn.microsoft.com/PSRemoteRegistry

    Only to find out that I can update this advance nic property change on all our 300 servers in a one line script!! hah! 

    gc c:\powershell\host\server.txt | get-regvalue -hive localmachine -key "SYSTEM\CurrentControlSet\Control\Class\{4D36E9
    72-E325-11CE-BFC1-08002bE10318}" -value *flowcontrol -ping -recurse | set-regstring -data 2147483648 –force

    Just like what those Powershell Guru's said at Teched. " To those whose been fighting the use of powershell. It's not about why or how? Its when, if you work on any Microsoft system components, in whatever capacity you will use it!! NO CHOICE ITS EVERYWHERE!!"

    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    20 Oct 2010 09:12 AM
    Thanks for using the module edm365f31! Here's my version :) (remove -whatIf to apply changes):

    $Key = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}"
    Get-RegValue -Hive LocalMachine -Key $key -Recurse -Type String -Value *FlowControl | Where-Object {$_.Key -match -match '\\00[67]\\'} | Set-RegString -Data 2147483648 -WhatIf


    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    edm365f31User is Offline
    Basic Member
    Basic Member
    Posts:100
    Avatar

    --
    25 Oct 2010 06:52 AM
    If the *flowcontrol is missing I can just use new-regstring instead.

    I was also told that its not a given that the Network Card will be in the 0006 or 0007 subkey(sometimes we also have add-on cards quad cards), with this bunch of servers it just so happen that most of them have dual nic cards.

    What seems to be a better option is look first for the existing Value of the Nic Card in the subkeys and when its found, update *flowcontrol or if its missing create it.

    Thanks for your help Shay.

    oldtechieUser is Offline
    New Member
    New Member
    Posts:2
    Avatar

    --
    07 Nov 2010 05:19 PM
    Hi Shay I am trying to use these new registry cmdlets that you point to in the PowerGui Thread - http://powergui.org/thread.jspa?thr...start=105. They are just what I wanted and works well for local machines, however as soon as I try a remote machine I get the dreaded "cannot find the network path"


    PS D:\powershell> Get-RegString -ComputerName "w002511552911" -Key "SOFTWARE\BroadSoft\BW Assistant\" -Hive LocalMachine -Value FriendlyVersion
    Get-RegString : Exception calling "OpenRemoteBaseKey" with "2" argument(s): "The network path was not found.
    "
    At line:1 char:14
    + Get-RegString <<<<  -ComputerName "w002511552911" -Key "SOFTWARE\BroadSoft\BW Assistant\" -Hive LocalMachine -Value FriendlyVersion
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-RegString.

    I have searched Google but still cant find an answer. I have run my powershell session with my elevated networked permissions. Any Ideas ? cheers Dene



    Mark E. SchillUser is Offline
    New Member
    New Member
    Posts:32
    Avatar

    --
    09 Nov 2010 04:56 PM
    Is the "Remote Registry" service running on the machine you are trying to connect to?
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer