Write-host Split Output ?
hi
newish ps, bear me.
i want split data, not sure on how it.
when run command data fine, wanted turn variable , output using write-host command, works, output in 1 line. im not sure sure on how split data when this. im happy use command, wanted see if done.
function mygetfirewallstate {
$serverlistfile = "$mypath\server_list.txt"
$serverlist = get-content $serverlistfile -erroraction silentlycontinue
foreach($computername in $serverlist)
{
$myfwstatus = get-netfirewallprofile | select name, enabled
write-host = myfwstatus -foregroundcolor black -backgroundcolor green
}
}
(this output, i'd on separate lines)
= @{name=domain; enabled=false} @{name=private; enabled=false} @{name=public; enabled=false}
any suggestions?
also it's not such big issue can use normal command output, know.
dee
get-netfirewallprofile |%{write-host $_.name,$_.enabled -fore green}
get-netfirewallprofile | format-table name,enabled
\_(ツ)_/
Windows Server > Windows PowerShell
Comments
Post a Comment