Get-ComputerManagement.psm1
function Get-ComputerManagement { <# .SYNOPSIS Open Computer Management Console on local or remote computer. .DESCRIPTION Open Computer Management Console on local or remote computer. .PARAMETER ComputerName Name of server to open Computer Management Console on remote computer. .PARAMETER ADSearchBase Active Directory SearchBase of server to open Computer Management Console on remote computer. .EXAMPLE Get-ComputerManagement Open Computer Management Console on local computer. .EXAMPLE Get-ComputerManagement -ComputerName pc1, pc2 Open Computer Management Console on multiple remote computer. .EXAMPLE Get-ComputerManagement -ADSearchBase "OU=Computers,DC=comodo,DC=com" Open Computer Management Console on Active Directory SearchBase computer. #> [CmdletBinding(DefaultParameterSetName = "Par1")] param ( [parameter(Position = 0, ParameterSetName = "Par1")] [string[]] $ComputerName = "localhost", [parameter(ParameterSetName = "Par2")] [string] $ADSearchBase ) if ($PsVersionTable.OS -match "Windows") { if ($ADSearchBase) { try { $ADSearch = New-Object System.DirectoryServices.DirectorySearcher $ADSearch.SearchRoot = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$ADSearchBase") $ADSearch.Filter = "(&(objectClass=computer)(objectCategory=computer)(!useraccountcontrol:1.2.840.113556.1.4.803:=2))" $ADSearchFind = $ADSearch.FindAll() } catch { Write-Warning "ADSearchBase not found" } $ComputerName = $ADSearchFind | ForEach-Object -Parallel { $_.Properties.name } | Sort-Object } if ($ComputerName) { $ComputerName | ForEach-Object -Parallel { $Computer = $_.ToUpper() if (($Computer -like "localhost") -or ((Test-Connection -Count 1 -TargetName $Computer).Status -match "Success")) { if ($Computer -like "localhost") { $Computer = $env:COMPUTERNAME } Start-Process "compmgmt.msc" -ArgumentList "/Computer=$Computer" } } } } else { Write-Warning "PSVersion OS not Windows" } } New-Alias -Name gco -Value Get-ComputerManagement Export-ModuleMember -Alias * -Function Get-ComputerManagement |