Created
June 4, 2017 05:24
-
-
Save janegilring/17bea68b3946f2542e7fbfc7da58c707 to your computer and use it in GitHub Desktop.
Data Protection Manager Community Extensions PowerShell module examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get active computer accounts from Active Directory who is running a server operating system | |
| $Date = Get-Date | |
| $InactiveComputerObjectThresholdInDays = '15' | |
| $Servers = Get-ADComputer -LDAPFilter "(&(objectCategory=computer)(operatingSystem=Windows Server*)(!serviceprincipalname=*MSClusterVirtualServer*))" -Properties description,lastlogontimestamp,operatingsystem | | |
| Where-Object {[datetime]::FromFileTime($_.lastlogontimestamp) -gt $Date.AddDays(-$InactiveComputerObjectThresholdInDays)} | | |
| Select-Object -Property @{name='computername';e={$_.name}},operatingsystem | | |
| Sort-Object -Property computername | |
| # Retrieve all computers who has DPM installed | |
| $DPMComputers = $Servers | Test-DPMCXComputer | Where-Object IsInstalled | |
| # Inspect the output | |
| $DPMComputers | Out-GridView | |
| # Get owner information from the DPM agents | |
| $DPMComputers | Where-Object IsDPMServer -eq $false | Get-DPMCXAgentOwner |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment