Udostępnij za pośrednictwem


Find-SCComputer

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

Syntax

SearchComputersByNameFilter (Default)

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

ValidateComputer

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

SearchComputersByADQuery

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

SearchBMCByIPAddressRange

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

SearchBMCByIPSubnet

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

ValidateBMC

Find-SCComputer
    -BMCAddress <String>
    -BMCProtocol <OutOfBandManagementType>
    -BMCRunAsAccount <RunAsAccount>
    [-VMMServer <ServerConnection>]
    [-BMCCustomConfigurationProvider <ConfigurationProvider>]
    [-BMCPort <Int32>]
    [-SMBiosGuid <Guid>]
    [-DeepDiscovery]
    [-DiscoveryID <Guid>]
    [-RunAsynchronously]
    [-JobVariable <String>]
    [<CommonParameters>]

Description

The Find-SCComputer cmdlet 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 (VMM).

  • All computers except library servers managed by VMM.

  • 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 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.

Examples

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

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

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.

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

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

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.

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

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

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.

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

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

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.

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

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

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.

Example 6: Perform deep discovery on a physical machine with bare-metal computer support

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

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.

The third command performs the deep discovery on the computer object and returns the physical machine object to $MyComputer01 variable.

The last command displays the properties of the computer object stored in the $MyComputer01 variable.

Parameters

-ADSearchFilter

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*))"

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchComputersByADQuery
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-All

Indicates that this cmdlet gets all subordinate objects independent of the parent object.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchBMCByIPAddressRange
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchBMCByIPSubnet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BMCAddress

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 BMC Address. However, it is also possible to create a PowerShell module that enables you to specify other types of addresses as the BMC address.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ValidateBMC
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BMCCustomConfigurationProvider

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.

Parameter properties

Type:ConfigurationProvider
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchBMCByIPAddressRange
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchBMCByIPSubnet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ValidateBMC
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BMCPort

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.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchBMCByIPAddressRange
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchBMCByIPSubnet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ValidateBMC
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BMCProtocol

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 that you use the BMCCustomConfigurationProvider parameter.

Parameter properties

Type:OutOfBandManagementType
Default value:None
Accepted values:IPMI, SMASH, Custom
Supports wildcards:False
DontShow:False

Parameter sets

SearchBMCByIPAddressRange
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchBMCByIPSubnet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ValidateBMC
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BMCRunAsAccount

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

Parameter properties

Type:RunAsAccount
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchBMCByIPAddressRange
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchBMCByIPSubnet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ValidateBMC
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ComputerName

Specifies the name of a computer that VMM can uniquely identify on your network. The acceptable values for this parameter are:

  • FQDN
  • IPv4 or IPv6 address
  • NetBIOS name

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ValidateComputer
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ComputerNameFilter

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

Example format: -ComputerNameFilter "host"

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchComputersByNameFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Credential

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.

Parameter properties

Type:VMMCredential
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchComputersByNameFilter
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchComputersByADQuery
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DeepDiscovery

Indicates that deep discovery is used for the specified computer.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ValidateBMC
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DiscoveryID

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

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Domain

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

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchComputersByNameFilter
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchComputersByADQuery
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExcludeVMMHost

Excludes virtual machine hosts currently managed by VMM.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchComputersByNameFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ValidateComputer
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchComputersByADQuery
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExcludeVMMLibrary

Excludes library servers currently managed by VMM.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchComputersByNameFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ValidateComputer
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchComputersByADQuery
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExcludeVMs

Excludes virtual machines.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchComputersByNameFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchComputersByADQuery
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-FindHyperVHost

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:FindHyperVHosts

Parameter sets

SearchComputersByNameFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchComputersByADQuery
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IPAddressRangeEnd

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchBMCByIPAddressRange
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IPAddressRangeStart

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchBMCByIPAddressRange
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-JobVariable

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchComputersByNameFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchComputersByADQuery
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchBMCByIPAddressRange
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SearchBMCByIPSubnet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ValidateBMC
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RunAsynchronously

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SMBiosGuid

Specifies the System Management BIOS globally unique identifier (SMBIOS GUID) for a physical computer that is associated with a record for that physical computer in VMM.

SMBIOS defines data structures and access methods that enable a user or application to store and retrieve information about hardware on this computer, such as the name of the system, manufacturer, or the system BIOS version. Windows operating systems retrieve SMBIOS data at system startup and make that data available to programs.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ValidateBMC
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Subnet

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchBMCByIPSubnet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VMMServer

Specifies a VMM server object.

Parameter properties

Type:ServerConnection
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

Computer

This cmdlet returns a Computer object.