import-module activedirectory $servers=Get-ADComputer -Filter {operatingsystem -Like “Windows server*”} | select -ExpandProperty Name $servers | Out-File “<Change path to>\Servers.txt” -append default $serversall = (Get-Content “<Change path to>\Servers.txt”) Start-Transcript -path “<Change path to>\output.txt” -append default foreach($vm in $serversall) { $iis = get-wmiobject…
PowerShell onboard server onto ATP (Advanced Threat Protection) & Azure Update Management
Below is a very simple script that i created that will onboard your server onto ATP / Windows Update management. Ensure the onboarding script is the latest from the portal The .BAT file this installs the MMA agent.
Windows Server List Features in Powershell
$domain= ”YOURDOMAIN”$pass=ConvertTo-SecureString -String ‘YOURPASS’ -AsPlainText -Force$creds=New-Object System.Management.Automation.pscredential -ArgumentList $domain, $pass (Get-Content c:\server_list.txt| Foreach{Invoke-Command -ComputerName $_ -Verbose -ScriptBlock{get-windowsfeature |Where-Object{$_.installed -eq $true -and $_.featuretype -eq ‘Role’} |select name, installed -ExcludeProperty subfeatures} -Credential $creds}) | `Format-Table -Property Name, Installed, @{name=’Server Name’;expression={$_.pscomputername}} -AutoSize