Hi everybody,
I’m trying to format a grid with remote windows services and for each service, i add a button to start or stop it, but it’s not working. When i try the code with my local computer : it’s works. When i try the code in a scriptblock, i’ve this message " The term ‘New-UDButton’ is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again"
Local computer :
New-UDGrid -Title "Services" -Endpoint {
Get-Service | select Name, DisplayName, Status | ForEach-Object {
[PSCustomObject] @{
"Name" = $_.Name
"Display Name" = $_.DisplayName
"Status" = [string]$_.Status
"Actions"=(New-UDButton -Text "Start" -Icon play -IconAlignment right -OnClick {Show-UDToast -Message "Clicked!"})
}
} | Out-UDGridData
}
Network computer :
New-UDGrid -Title "Services" -Endpoint {
$session = New-PSSession -HostName administrator@192.168.92.143
$a = Invoke-Command -Session $session -ScriptBlock {
Get-Service | select Name, DisplayName, Status | ForEach-Object {
[PSCustomObject] @{
"Name" = $_.Name
"Display Name" = $_.DisplayName
"Status" = [string]$_.Status
"Actions"=(New-UDButton -Text "Start" -Icon play -IconAlignment right -OnClick {Show-UDToast -Message "Clicked!"})
}
}
}| Out-UDGridData
}
How i can do this please ?