I have the following script but am having issues exporting the information to a file with the Server name and if IIS is installed. Any help? This displays on screen currently.
$servers = (Get-Content c:\temp\servers.txt)
foreach($vm in $servers){
$iis = get-wmiobject Win32_Service -ComputerName $vm -Filter "name='IISADMIN'"
if($iis.State -eq "Running")
{Write-Host "IIS is running on $vm"}
else
{Write-Host "IIS is not running on $vm"}
}