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

Popular posts from this blog

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS