none
Notable to get the registry D word value from text box form RRS feed

  • Question

  • Hi team,

    I want query registry d word  value on remote servers

    note:every time registry d word value requirement  location will be changed..so I want to query the values from a text box winform.

    using variable $sname = $filter2.text

    example :I will give the "hklm:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -name DisableCAD

    in the text box form..but iam getting error. Please advice

    below is the  code

    ##################

     function get-regvalue{
     $outputBox.Clear()
     $outputBox.text= "GettingRegistry values please wait"
     $servers=$InputBox.lines.Split("`n")
     $date =Get-Date
     $ct = "Task Completed @ " + $date
     $sname = $filter2.text

     foreach ($server in $servers){

     $regresult= Invoke-Command -ComputerName $server  -ScriptBlock  $sname | Out-String

     
     $outputBox.Appendtext("{0}`n" -f $regresult + "`n $ct")
     }

     }

    #####################

    error

    Invoke-Command : Cannot bind parameter 'SacriptBlock'. Cannot convert the {Get-ItemProperty "hklm:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -name DisableCAD}

    • Moved by Bill_Stewart Tuesday, November 7, 2017 9:18 PM Possible help vampire
    Wednesday, September 6, 2017 6:15 AM

All replies

  • To query values in a textbox just use the value of the textbox to get the value.

    You are still spelling the parameter incorrectly and you have not fixed that.  This has nothing to do with getting values from a textbox.

    To get a value from a text box just reference the textbox's "text" property.

    To pass a value to a remote invocation use the "Arguments" parameter.

    See: "help Invoke-Command -full" for examples.


    \_(ツ)_/

    Wednesday, September 6, 2017 6:42 AM