Skip to content

Instantly share code, notes, and snippets.

@Agazoth
Last active February 25, 2019 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Agazoth/1076fd0a77d0e2de8e58184dd18ecfde to your computer and use it in GitHub Desktop.
Save Agazoth/1076fd0a77d0e2de8e58184dd18ecfde to your computer and use it in GitHub Desktop.
Out-Default -InputObject @{Source=$env:COMPUTERNAME;Target=$env:COMPUTERNAME} -PipelineVariable ST | foreach {compare-object (Get-WindowsFeature -ComputerName $ST['Source']).where{$_.installed} (Get-WindowsFeature -ComputerName $ST['Target']).where{$_.installed}} | ForEach-Object {if ($_.SideIndicator -eq '<='){Install-WindowsFeature -Name $_.InputObject.Name -ComputerName $ST['Target']} elseif ($_.SideIndicator -eq '=>') {Uninstall-WindowsFeature -Name $_.InputObject.Name -ComputerName $ST['Target']}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment