Find-SCComputer

Applies To: System Center 2012 - Virtual Machine Manager

Find-SCComputer

Searches for computers by querying Active Directory, and returns the computer objects.

Syntax

Parameter Set: SearchComputersByNameFilter
Find-SCComputer -Credential <VMMCredential> -Domain <String> [-ComputerNameFilter <String> ] [-DiscoveryID <Guid> ] [-ExcludeVMMHost] [-ExcludeVMMLibrary] [-ExcludeVMs] [-FindHyperVHost] [-JobVariable <String> ] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: SearchBMCByIPAddressRange
Find-SCComputer -BMCProtocol <OutOfBandManagementType> -BMCRunAsAccount <RunAsAccount> -IPAddressRangeEnd <String> -IPAddressRangeStart <String> [-All] [-BMCCustomConfigurationProvider <ConfigurationProvider> ] [-BMCPort <Int32> ] [-DiscoveryID <Guid> ] [-JobVariable <String> ] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: SearchBMCByIPSubnet
Find-SCComputer -BMCProtocol <OutOfBandManagementType> -BMCRunAsAccount <RunAsAccount> -Subnet <String> [-All] [-BMCCustomConfigurationProvider <ConfigurationProvider> ] [-BMCPort <Int32> ] [-DiscoveryID <Guid> ] [-JobVariable <String> ] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: SearchComputersByADQuery
Find-SCComputer -ADSearchFilter <String> -Credential <VMMCredential> -Domain <String> [-DiscoveryID <Guid> ] [-ExcludeVMMHost] [-ExcludeVMMLibrary] [-ExcludeVMs] [-FindHyperVHost] [-JobVariable <String> ] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: ValidateBMC
Find-SCComputer -BMCAddress <String> -BMCProtocol <OutOfBandManagementType> -BMCRunAsAccount <RunAsAccount> [-BMCCustomConfigurationProvider <ConfigurationProvider> ] [-BMCPort <Int32> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: ValidateComputer
Find-SCComputer [-ComputerName] <String> [-Credential <VMMCredential> ] [-DiscoveryID <Guid> ] [-ExcludeVMMHost] [-ExcludeVMMLibrary] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Detailed Description

Searches for one or more computers by querying Active Directory, and returns the computer objects.

You can use this cmdlet to query Active Directory for computers based on specified criteria, or a combination of criteria, including:

- The fully qualified domain name (FQDN) of a computer

- All or part of the computer name

- The name of a domain

- All computers except hosts managed by Virtual Machine Manager

- All computers except library servers managed by Virtual Machine Manager

- Only Hyper-V hosts

- Bare-metal computers that have out-of-band controllers

NOTE: If you add a new computer (such as a host or library server) located in an Active Directory domain to System Center Virtual Machine Manager (VMM) and then immediately run the Discover-Computer cmdlet, the cmdlet might not immediately discover the new computer when it searches Active Directory. This delay may occur because data about the new computer might not have replicated yet across the Active Directory domain. If you are a Domain Administrator, you can use the Active Directory Sites and Services console to force the data to replicate immediately.

For more information about Find-SCComputer, type: "Get-Help Find-SCComputer -online".

Parameters

-ADSearchFilter<String>

Defines an Active Directory query for discovery. Use this parameter to specify a query that contains Active Directory domain information and search filters.

Example format: -ADSearchFilter "(&(sAMAccountType=805306369)(name=katarina*)(objectCategory=computer)(objectClass =computer)(operatingSystem=Windows\20Server*))"

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-All

Retrieves a full list of all subordinate objects independent of the parent object. For example, the command Get-SCVirtualDiskDrive -All retrieves all virtual disk drive objects regardless of the virtual machine object or template object that each virtual disk drive object is associated with.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-BMCAddress<String>

Specifies, or updates, the out-of-band baseboard management controller (BMC) address for a specific physical machine. This might be an IP address, the fully qualified domain name (FQDN), or the DNS prefix (which is usually the same name as the NetBIOS name).

Typically, the BMC address and its connection to the network are separate from the IP address associated with a standard network adapter. Alternatively, some computers do use a standard network adapter to provide a single address for the BMC and for the network adapter. However, the BMC address has a unique port and is thus uniquely identifiable on the network.

Example IPv4 format: -BMCAddress "10.0.0.21"

Example Ipv6 format: -BMCAddress "2001:4898:2a:3:657b:9c7a:e1f0:6829"

Example FQDN format: -BMCAddress "Computer01.Contoso.com"

Example NetBIOS format: -BMCAddress "Computer01"

NOTE: By default, VMM uses an IP address or FQDN for the BMCAddress. However, it is also possible to create a Windows PowerShell module that enables you to specify other types of addresses as the BMC address.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-BMCCustomConfigurationProvider<ConfigurationProvider>

Specifies, or updates, a configuration provider object for a baseboard management controller (BMC). A configuration provider is a plug-in to VMM that translates VMM PowerShell commands to API calls that are specific to a type of baseboard management controller. This parameter should be used with the Custom BMCProtocol.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-BMCPort<Int32>

Specifies, or updates, the out-of-band baseboard management controller (BMC) port for a specific physical machine. A BMC port is also known as a service processor port. Example default ports are 623 for IPMI and 443 for SMASH over WS-Man.

Example format: -BMCPort 80

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-BMCProtocol<OutOfBandManagementType>

Specifies, or updates, the protocol that VMM uses to communicate with the out-of-band baseboard management controller (BMC). Valid values are: IPMI, SMASH, Custom.

A BMC (also known as a service processor or management controller) is a specialized controller on the motherboard of a server that acts an interface between the hardware and system management software. If the motherboard of a physical machine includes a BMC, when the machine is plugged in (whether it is powered off or powered on, and whether or not an operating system is installed), information about system hardware and the state of that system hardware health is available.

Example format: -BMCProtocol "Custom"

NOTE: The Custom protocol requires using the BMCCustomCondigurationProvider.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-BMCRunAsAccount<RunAsAccount>

Specifies the Run As account to use with the baseboard management controller (BMC) device.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ComputerName<String>

Specifies the name of a computer that VMM can uniquely identify on your network. Valid formats are: FQDN, IPv4 or IPv6 address, or NetBIOS name.

NOTE: See the examples for a specific cmdlet to determine how that cmdlet specifies the computer name.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ComputerNameFilter<String>

Specifies the partial or full name of a computer that the cmdlet will try to discover in Active Directory.

Example format: -ComputerNameFilter "host"

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Credential<VMMCredential>

Specifies a credential object or, for some cmdlets, a Run As account object that contains the user name and password of an account that has permission to perform this action. Or, in the case of Restart-SCJob, has permission to complete a restarted task.

For more information about the PSCredential object, type: "Get-Help Get-Credential".

For more information about Run As accounts, type: "Get-Help New-SCRunAsAccount".

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DiscoveryID<Guid>

For internal use only (not for use in your code).

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Domain<String>

Specifies a fully qualified domain name (FQDN) for an Active Directory domain.

Example format: -Domain "Domain01.Corp.Contoso.com"

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ExcludeVMMHost

Excludes virtual machine hosts currently managed by VMM.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ExcludeVMMLibrary

Excludes library servers currently managed by VMM.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ExcludeVMs

Excludes virtual machines.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FindHyperVHost

Searches for computers running Windows Server 2008 or later on which the Hyper-V server role is enabled.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IPAddressRangeEnd<String>

Specifies the last IP address in a range of IP addresses. Use with IPAddressRangeStart.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IPAddressRangeStart<String>

Specifies the first IP address in a range of IP addresses. Use with IPAddressRangeEnd.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

Specifies that job progress is tracked and stored in the variable named by this parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Subnet<String>

Specifies an IP subnet (IPv4 or IPv6) in Classless Inter-Domain Routing (CIDR) notation.

Example format for an IPv4 subnet: 192.168.0.1/24

Example format for an IPv6 subnet: FD4A:29CD:184F:3A2C::/64

NOTE: An IP subnet cannot overlap with any other subnet in a host group or child host groups.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMMServer<ServerConnection>

Specifies a VMM server object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Computer

Examples

1: Search for computers in a specific domain that meet the specified criteria.

The first command gets the Run As account object named Host Computer Account 01 and stores the object in the $RunAsAccount variable.

The second command queries Active Directory and returns a list of Hyper-V computer objects for computers that are located in the Contoso.com domain, that have a name starting with "host", and that are not managed by VMM. As this command is processed, $RunAsAccount provides credentials to Find-SCComputer.

NOTE: When you use Find-SCComputer with the Domain parameter, you must specify the fully qualified domain name.

PS C:\> $RunAsAccount = Get-SCRunAsAccount -Name "Host Computer Account 01"
PS C:\> Find-SCComputer -ComputerNameFilter "host" -Domain "Contoso.com" -FindHyperVHosts -ExcludeVMMHost -RunAsAccount $RunAsAccount

2: Search for a specific computer by name and validate its properties in Active Directory.

This command uses the fully qualified domain name (FQDN) of the computer named VMHost01 to find this computer in Active Directory, returns the computer object, and displays the computer object properties to the user.

PS C:\> Find-SCComputer -ComputerName "VMHost01.Contoso.com"

3: Search for all computers in the specified domain that are not a VMM library server.

The first command gets the Run As account object named Host Computer Account 01 and stores the object in the $RunAsAccount variable.

The second command queries Active Directory for all computers in the Contoso.com domain that include "vmm" in the computer name except for VMM library servers. As this command is processed, $RunAsAccount provides credentials to Find-SCComputer.

PS C:\> $RunAsAccount = Get-SCRunAsAccount -Name "Host Computer Account 01"
PS C:\> Find-SCComputer -ComputerNameFilter "vmm" -Domain "Contoso.com" -ExcludeVMMLibrary -RunAsAccount $RunAsAccount

4: Find all unmanaged computers in the specified domain by using an Active Directory query.

The first command gets the Run As account object named Host Computer Account 01 and stores the object in the $RunAsAccount variable.

The second command queries Active Directory for all computers in the Contoso.com domain that meet the query criteria: any Windows Server 2008 R2 computer with a name that starts with Test0 but which are not VMM library servers or VMM hosts. As this command is processed, $RunAsAccount provides credentials to Find-SCComputer.

PS C:\> $RunAsAccount = Get-SCRunAsAccount -Name "Host Computer Account 01"
PS C:\> Find-SCComputer -ADSearchFilter "(&(sAMAccountType=805306369)(name=Test0*)(objectCategory=computer)(objectClass=computer)(operatingSystem=Windows\20Server\202008\20R2*))" -Domain "Contoso.com" -ExcludeVMMLibrary -ExcludeVMMHost -RunAsAccount $RunAsAccount

5: Find bare-metal computers that have out-of-band controllers that are within a specific network range.

The first command gets the Run As account object named BMC Account 01 and stores the object in the $BMCRunAsAccount variable.

The second command scans the network for a physical computer with the specified BMCAddress. As this command is processed, $BMCRunAsAccount provides credentials to Find-SCComputer.

PS C:\> $BMCRunAsAccount = Get-SCRunAsAccount "BMC Account 01"
PS C:\> Find-SCComputer -BMCAddress "10.10.0.1" -BMCRunAsAccount $BMCRunAsAccount -BMCProtocol "IPMI"

Add-SCVMHost

New-SCVMHost