Skip to content

Instantly share code, notes, and snippets.

@janegilring
Created June 4, 2017 05:24
Show Gist options
  • Select an option

  • Save janegilring/17bea68b3946f2542e7fbfc7da58c707 to your computer and use it in GitHub Desktop.

Select an option

Save janegilring/17bea68b3946f2542e7fbfc7da58c707 to your computer and use it in GitHub Desktop.
Data Protection Manager Community Extensions PowerShell module examples
# 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