commands

^

Export-DbaRegServer

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Export-DbaRegServer on GitHub.
Want to see the Bill Of Health for this command? Check out Export-DbaRegServer.

Synopsis

Exports registered servers and registered server groups to file

Description

Exports registered servers and registered server groups to file

Syntax

Export-DbaRegServer
    [[-SqlInstance] <DbaInstanceParameter[]>]
    [[-SqlCredential] <PSCredential>]
    [[-InputObject] <Object[]>]
    [[-Path] <String>]
    [[-FilePath] <FileInfo>]
    [[-CredentialPersistenceType] <String>]
    [[-Group] <Object[]>]
    [[-ExcludeGroup] <Object[]>]
    [-Overwrite]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Export-DbaRegServer -SqlInstance sql2008

Exports all Registered Server and Registered Server Groups on sql2008 to an automatically generated file name in the current directory

Example: 2
PS C:\> Get-DbaRegServer -SqlInstance sql2008, sql2012 | Export-DbaRegServer

Exports all registered servers on sql2008 and sql2012. Warning - each one will have its own individual file. Consider piping groups.

Example: 3
PS C:\> Get-DbaRegServerGroup -SqlInstance sql2008, sql2012 | Export-DbaRegServer

Exports all registered servers on sql2008 and sql2012, organized by group.

Optional Parameters

-SqlInstance

The target SQL Server instance or instances.

Alias
Required False
Pipeline false
Default Value
-SqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.

Alias
Required False
Pipeline false
Default Value
-InputObject

Enables piping from Get-DbaRegServer, Get-DbaRegServerGroup, CSVs and other objects.
If importing from CSV or other object, a column named ServerName is required. Optional columns include Name, Description and Group.

Alias
Required False
Pipeline true (ByValue)
Default Value
-Path

Specifies the directory where the file or files will be exported.

Alias
Required False
Pipeline false
Default Value (Get-DbatoolsConfigValue -FullName 'Path.DbatoolsExport')
-FilePath

Specifies the full file path of the output file. The file must end with .xml or .regsrvr

Alias OutFile,FileName
Required False
Pipeline false
Default Value
-CredentialPersistenceType

Used to specify how the login and passwords are persisted. Valid values include None, PersistLoginName and PersistLoginNameAndPassword.

Alias
Required False
Pipeline false
Default Value None
Accepted Values None,PersistLoginName,PersistLoginNameAndPassword
-Group

Specifies one or more groups to include.

Alias
Required False
Pipeline false
Default Value
-ExcludeGroup

Specifies one or more groups to exclude.

Alias
Required False
Pipeline false
Default Value
-Overwrite

Specifies to overwrite the output file (FilePath) if it already exists.

Alias
Required False
Pipeline false
Default Value False
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False