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}