我想知道如何使用Invoke-Command传递参数以在脚本中使用以远程运行。
hostinfo = gethostbyname (hostname);
saddr->sin_addr = *(struct in_addr *) hostinfo->h_addr;
我想知道这是否可行以及修复此脚本需要做些什么? 感谢
答案 0 :(得分:0)
$cname = Read-Host "Computer Name?"
$event = Read-Host "What event?"
$eventfilter = Read-Host "What key word are you looking for?"
$amount = Read-Host "How many events do you want to see?"
Invoke-Command -cn $cname -ScriptBlock {Get-EventLog -cn $using:cname -LogName $using:event -Message "*$eventfilter*" -Newest $using:amount | FT -Wrap}