diff --git a/Add-ConnectionHashValue.html b/Add-ConnectionHashValue.html new file mode 100644 index 00000000..ec46fa13 --- /dev/null +++ b/Add-ConnectionHashValue.html @@ -0,0 +1,542 @@ + + + +
+ + ++ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Add-ConnectionHashValue -Key
+Add-ConnectionHashValue[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Add-ConnectionHashValue; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Add-ConnectionHashValue on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Add-ConnectionHashValue.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function to add an item to the TEPP cache.
+Internal function to add an item to the TEPP cache.
+Add-TeppCacheItem
+ [-SqlInstance] <DbaInstanceParameter>
+ [-Type] <String>
+ [-Name] <String>
+ [<CommonParameters>]
+
+
++
+
PS > Add-TeppCacheItem -SqlInstance $server -Type database -Name AdventureWorks
+Adds an entry for the database AdventureWorks in the TEPP cache.
The SQL Server instance.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The type of object. Must be part of "[Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache.Keys".
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The name of the object that should be added to the cache. Will not be added if already in cache.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Add-TeppCacheItem on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Add-TeppCacheItem.
+ | + |
---|---|
Author | +Charles Hightower | +
Availability | +Windows, Linux, macOS | +
+
Filters InputObject, Compares a property to value(s) using a given sql server collation
+The Compare-DbaCollationSensitiveObject command filters an Inputobject using a string comparer builder provided by the SMO, for a given sql server collation.
+Compare-DbaCollationSensitiveObject -InputObject <PSObject> -Property <String> -In
+ [-Value <Object>] -Collation <String>
+ [<CommonParameters>]
+
+Compare-DbaCollationSensitiveObject -InputObject <PSObject> -Property <String> -NotIn
+ [-Value <Object>] -Collation <String>
+ [<CommonParameters>]
+
+Compare-DbaCollationSensitiveObject -InputObject <PSObject> -Property <String> -Eq
+ [-Value <Object>] -Collation <String>
+ [<CommonParameters>]
+
+Compare-DbaCollationSensitiveObject -InputObject <PSObject> -Property <String> -Ne
+ [-Value <Object>] -Collation <String>
+ [<CommonParameters>]
+
+
++
+
PS C:\> $server = Connect-DbaInstance -SqlInstance localhost
+PS C:\> $lastCopyOnlyBackups = Get-DbaDbBackupHistory -SqlInstance $server -LastFull -IncludeCopyOnly | Where-Object IsCopyOnly
+PS C:\> $server.Databases | Compare-DbaCollationSensitiveObject -Property Name -In -Value $lastCopyOnlyBackups.Database -Collation $server.Collation
+
+Returns all databases on the local default SQL Server instance with copy only backups using the collation of the SqlInstance
PS C:\> $server = Connect-DbaInstance -SqlInstance localhost
+PS C:\> $lastFullBackups = Get-DbaDbBackupHistory -SqlInstance $server -LastFull
+PS C:\> $server.Databases | Compare-DbaCollationSensitiveObject -Property Name -NotIn -Value $lastFullBackups.Database -Collation $server.Collation
+
+Returns only the databases on the local default SQL Server instance without a Full Backup, using the collation of the SqlInstance
The Object to Filter
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
Name of the Property of InputObject to compare
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Members of InputObject where the value of the Property is within the Value set are returned
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | +False | +
Members of InputObject where the value of the Property is not within the Value set are returned
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | +False | +
Members of InputObject where the value of the Property is equivalent to the Value
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | +False | +
Members of InputObject where the value of the Property is not not equivalent to the Value
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | +False | +
Name of the collation to use for comparison
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Object that Property is compared against
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Compare-DbaCollationSensitiveObject on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Compare-DbaCollationSensitiveObject.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function that creates SMO server object.
+Internal function that creates SMO server object.
+Connect-AsServer
+ [-AsServer] <Object>
+ [-ParameterConnection]
+ [<CommonParameters>]
+
+
++
+
PS > Connect-AsServer -AsServer localhost
+Connects to SSAS on the local server
Analysis Server
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Shorten the timeout
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Connect-AsServer on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Connect-AsServer.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function to establish smo connections using a connstring
+Internal function to establish smo connections using a connstring
+Can interpret any of the following types of information:
+Connect-ConnstringInstance
+ [-SqlInstance] <DbaInstanceParameter>
+ [[-SqlCredential] <PSCredential>]
+ [[-StatementTimeout] <Int32>]
+ [[-MinimumVersion] <Int32>]
+ [-AzureUnsupported]
+ [-NonPooled]
+ [<CommonParameters>]
+
+
++
+
PS > Connect-DbaInstance -SqlInstance sql2014
+Connect to the Server sql2014 with native credentials.
The SQL Server instance to restore to.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Allows you to login to servers using SQL Logins as opposed to Windows Auth/Integrated/Trusted.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Sets the number of seconds a statement is given to run before failing with a timeout error.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
The minimum version that the calling command will support
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
Throw if Azure is detected but not supported
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Connect-ConnstringInstance on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Connect-ConnstringInstance.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Connect-ReplicationDB [-Server
Connect-ReplicationDB[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Connect-ReplicationDB; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Connect-ReplicationDB on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Connect-ReplicationDB.
+ | + |
---|---|
Author | +Kirill Kravtsov (@nvarscar) | +
Availability | +Windows, Linux, macOS | +
+
Converts byte object into hex string
+Converts byte object ([byte[]]@(1,100,23,54)) into the hex string (e.g. '0x01641736') +Used when working with SMO logins and their byte parameters: sids and hashed passwords
+Convert-ByteToHexString
+ [[-InputObject] <Byte[]>]
+ [<CommonParameters>]
+
+
++
+
PS > Convert-ByteToHexString ([byte[]]@(1,100,23,54))
+Returns hex string '0x01641736'
PS > Convert-ByteToHexString 18,52
+Returns hex string '0x1234'
Input byte[] object (e.g. [byte[]]@(18,52))
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Convert-ByteToHexString on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Convert-ByteToHexString.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Convert-ConnectionString -ConnectionString <string[]> [
Convert-ConnectionString[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Convert-ConnectionString; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Convert-ConnectionString on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Convert-ConnectionString.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function that makes db versions human readable
+Internal function that makes db versions human readable
+Convert-DbVersionToSqlVersion
+ [[-dbversion] <String>]
+ [<CommonParameters>]
+
+
++
+
PS > Convert-DbVersionToSqlVersion -dbversion 856
+Returns "SQL Server vNext CTP1"
Analysis Server
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Convert-DbVersionToSqlVersion on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Convert-DbVersionToSqlVersion.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Convert-DbaIndexToTable [-SqlInstance
Convert-DbaIndexToTable[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Convert-DbaIndexToTable; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Convert-DbaIndexToTable on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Convert-DbaIndexToTable.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Converts Lsns betweent Hex and/or numeric formats
+Function takes an LSN in either split Hexadecimal format () or numberic
+It then returns both formats in an object
+Convert-DbaLSN
+ [[-LSN] <String>]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS > PS C:\ $output = Convert-DbaLSN -LSN 0000002f:000044aa:002b
+Will return object $Output with the following value
+$Output.HexLSN = 0000002f:000044aa:002b
+$Output.NumbericLSN =
The LSN value to be converted
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Convert-DbaLSN on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Convert-DbaLSN.
+ | + |
---|---|
Author | +Sander Stad (@sqlstad, sqlstad.nl) | +
Availability | +Windows, Linux, macOS | +
+
Convert a value to a TSQL format that be used in queries
+The command will take a value and with the data type return it in a format +that can be used in queries.
+For instance, a value "this is text" with data type 'varchar' will be returned as +'this is text' with the single quotes
+It returns an object with the following properties
+Convert-DbaMaskingValue
+ [[-Value] <Object[]>]
+ [[-DataType] <String>]
+ [-Nullable]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS > Convert-DbaMaskingValue -Value "please convert this" -DataType varchar
+Will convert ""please convert this" to "'please convert this'"
PS > Convert-DbaMaskingValue -Value $null -DataType varchar -Nullable
+Will convert null to "NULL"
The value to be converted
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
Data type the value needs to be converted to
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
It's possible to send a null value. It will then be converted to 'NULL' for SQL Server
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
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 | +
+
Want to see the source code for this command? Check out Convert-DbaMaskingValue on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Convert-DbaMaskingValue.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Transforms the Exception input to the message system.
+Transforms the Exception input to the message system.
+If there is an exception running a transformation scriptblock, it will log the error in the transform error queue and return the original object instead.
+Convert-DbaMessageException
+ [-Exception] <Object>
+ [-FunctionName] <String>
+ [-ModuleName] <String>
+ [<CommonParameters>]
+
+
++
+
PS C:\> Convert-DbaMessageException -Exception $Exception -FunctionName 'Get-Test' -ModuleName 'MyModule'
+
+Checks internal storage for definitions that require a Exception transform, and either returns the original object or the transformed object.
The input Exception object, that might have to be transformed (may not either)
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The function writing the message
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The module, that the function writing the message is part of
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Convert-DbaMessageException on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Convert-DbaMessageException.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Processes the effective message level of a message
+Processes the effective message level of a message
+Convert-DbaMessageLevel
+ [-OriginalLevel] {Critical | Important | Output | Significant | VeryVerbose | Verbose | SomewhatVerbose | System | Debug | InternalComment | Warning}
+ [-FromStopFunction] <Boolean>
+ [-Tags] <String[]>
+ [-FunctionName] <String>
+ [-ModuleName] <String>
+ [<CommonParameters>]
+
+
++
+
PS > Convert-DbaMessageLevel -OriginalLevel $Level -FromStopFunction $fromStopFunction -Tags $Tag -FunctionName $FunctionName -ModuleName $ModuleName
+This will convert the original level of $Level based on the transformation rules for levels.
The level the message was originally written to
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Whether the message was passed through Stop-Function first.
+This is used to increment the automatic message level decrement counter by 1 (so it ignores the fact, that it was passed through Stop-Function).
+The automatic message level decrement functionality allows users to make nested commands' messages be less verbose.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | +False | +
The tags that were added to the message
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The function that wrote the message.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The module the function writing the message comes from.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Convert-DbaMessageLevel on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Convert-DbaMessageLevel.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Transforms the target input to the message system.
+Transforms the target input to the message system.
+If there is an exception running a transformation scriptblock, it will log the error in the transform error queue and return the original object instead.
+Convert-DbaMessageTarget
+ [-Target] <Object>
+ [-FunctionName] <String>
+ [-ModuleName] <String>
+ [<CommonParameters>]
+
+
++
+
PS C:\> Convert-DbaMessageTarget -Target $Target -FunctionName 'Get-Test' -ModuleName 'MyModule'
+
+Checks internal storage for definitions that require a target transform, and either returns the original object or the transformed object.
The input target object, that might have to be transformed (may not either)
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The function writing the message
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The module, that the function writing the message is part of
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Convert-DbaMessageTarget on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Convert-DbaMessageTarget.
+ | + |
---|---|
Author | +Marcin Gminski (@marcingminski) | +
Availability | +Windows, Linux, macOS | +
+
Converts literal string status to a html color
+This function acceptes Agent Job status as literal string input and covnerts to html color. +This is internal function, part of ConvertTo-DbaTimeline
+Convert-DbaTimelineStatusColor
+ [-Status] <String>
+ [<CommonParameters>]
+
+
++
+
PS > Convert-DbaTimelineStatusColor ("Succeeded")
+Returned string: #36B300
The Status input parameter must be a valid SQL Agent Job status as literal string as defined in MS Books:
+Status of the job execution:
+Failed
+Succeeded
+Retry
+Canceled
+In Progress
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Convert-DbaTimelineStatusColor on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Convert-DbaTimelineStatusColor.
+ | + |
---|---|
Author | +Kirill Kravtsov (@nvarscar) | +
Availability | +Windows, Linux, macOS | +
+
Converts hex string into byte object
+Converts hex string (e.g. '0x01641736') into the byte object ([byte[]]@(1,100,23,54)) +Used when working with SMO logins and their byte parameters: sids and hashed passwords
+Convert-HexStringToByte
+ [[-InputObject] <String>]
+ [<CommonParameters>]
+
+
++
+
PS > Convert-HexStringToByte '0x01641736'
+Returns byte[] object [byte[]]@(1,100,23,54)
PS > Convert-HexStringToByte '1234'
+Returns byte[] object [byte[]]@(18,52)
Input hex string (e.g. '0x1234' or 'DBA2FF')
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Convert-HexStringToByte on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Convert-HexStringToByte.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
ConvertFrom-SecurePass [-InputObject
ConvertFrom-SecurePass[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+ConvertFrom-SecurePass; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+
Want to see the source code for this command? Check out ConvertFrom-SecurePass on GitHub.
+
+Want to see the Bill Of Health for this command? Check out ConvertFrom-SecurePass.
+ | + |
---|---|
Author | +Marcin Gminski (@marcingminski) | +
Availability | +Windows, Linux, macOS | +
+
Converts Datetime input to a Java Script date format
+This function acceptes date time input and converts to a Java script compatible format. +Java Script date time format: +New date (yyyy, MM, dd, HH, mm, ss)
+This is internal function part of ConvertTo-DbaTimeline
+ConvertTo-JsDate
+ [-InputDate] <DateTime>
+ [<CommonParameters>]
+
+
++
+
PS > ConvertTo-JsDate (Get-Date)
+Returned output: new Date(2018, 7, 14, 07, 40, 42)
The InputDate parameter must be a valid datetime type
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out ConvertTo-JsDate on GitHub.
+
+Want to see the Bill Of Health for this command? Check out ConvertTo-JsDate.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Disconnect-Regserver [-Server
Disconnect-Regserver[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Disconnect-Regserver; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Disconnect-Regserver on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Disconnect-Regserver.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Returns a SQL Server setup.exe filesystem object based on parameters
+Recursively searches specified folder for a setup.exe file that has the following .VersionInfo:
+Find-SqlInstanceSetup
+ [[-ComputerName] <DbaInstanceParameter>]
+ [[-Credential] <PSCredential>]
+ [[-Authentication] <String>]
+ [-Version] <Version>
+ [[-Path] <String[]>]
+ [<CommonParameters>]
+
+
++
+
PS>Find-SqlInstanceSetup -Version 11.0 -Path \my\updates
+Looks for setup.exe in \my\updates and all the subfolders
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +$env:COMPUTERNAME | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +Default | +
Accepted Values | +Default,Basic,Negotiate,NegotiateWithImplicitCredential,Credssp,Digest,Kerberos | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Find-SqlInstanceSetup on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Find-SqlInstanceSetup.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Returns a SQL Server KB filesystem object based on parameters
+Recursively searches specified folder for a file that matches the following pattern: +"SQLServer$MajorVersion-KB$KB-$Architecture*.exe"
+Find-SqlInstanceUpdate
+ [[-ComputerName] <DbaInstanceParameter>]
+ [[-Credential] <PSCredential>]
+ [[-Authentication] <String>]
+ [-MajorVersion] <String>
+ [-KB] <String>
+ [[-Architecture] <String>]
+ [[-Path] <String[]>]
+ [<CommonParameters>]
+
+
++
+
PS>Find-SqlInstanceUpdate -MajorVersion 2016 -KB 412348 -Path \my\updates
+Looks for SQLServer2016-KB412348-x64*.exe in \my\updates and all the subfolders
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +Default | +
Accepted Values | +Default,Basic,Negotiate,NegotiateWithImplicitCredential,Credssp,Digest,Kerberos | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +x64 | +
Accepted Values | +x86,x64 | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +(Get-DbatoolsConfigValue -Name 'Path.SQLServerUpdates') | +
+
Want to see the source code for this command? Check out Find-SqlInstanceUpdate on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Find-SqlInstanceUpdate.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-ADSConnection
+Get-ADSConnection[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-ADSConnection; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+
Want to see the source code for this command? Check out Get-ADSConnection on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-ADSConnection.
+ | + |
---|---|
Author | +Adam Lancaster https://github.com/lancasteradam | +
Availability | +Windows, Linux, macOS | +
+
The legacy bulk copy library still uses a 4 byte integer to track the number of rows copied. That 4 byte integer is subject to overflow/wraparound +if the number of rows copied is greater than an integer can support. The SqlRowsCopiedEventArgs.RowsCopied property is defined as an Int64 +but a 4 byte integer is used in the underlying legacy library. See https://github.com/dataplat/dbatools/issues/6927 for more details.
+Determines the accurate total rows copied even if the bulkcopy.RowsCopied has experienced integer wrap. +This internal function is used from:
+Copy-DbaDbTableData.ps1 +Import-DbaCsv.ps1 +Write-DbaDbTableData.ps1
+Get-AdjustedTotalRowsCopied
+ [[-ReportedRowsCopied] <Object>]
+ [[-PreviousRowsCopied] <Object>]
+ [<CommonParameters>]
+
+
++
+
The number of rows copied as reported by the bulk copy library (i.e. https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlrowscopiedeventargs.rowscopied)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The previous number of rows reported by the bulk copy library.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-AdjustedTotalRowsCopied on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-AdjustedTotalRowsCopied.
+ | + |
---|---|
Author | +Stuart Moore (@napalmgram), stuart-moore.com | +
Availability | +Windows, Linux, macOS | +
+
Returns details of the last full backup of a SQL Server 2000 database
+Backup History command to pull limited history from a SQL 2000 instance. If not using SQL 2000, please use Get-DbaDbBackupHistory which pulls more infomation, and has more options. This is just here to cope with 2k and copy-DbaDatabase issues
+Get-BackupAncientHistory
+ [-SqlInstance] <DbaInstanceParameter>
+ [[-SqlCredential] <PSCredential>]
+ [[-Database] <Object[]>]
+ [[-FileNameStub] <String>]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
SQL Server name or SMO object representing the SQL Server to connect to. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Specifies one or more database(s) to process. If unspecified, all databases will be processed.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Get-BackupAncientHistory on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-BackupAncientHistory.
+ | + |
---|---|
Author | +Jason Chester (@jasonchester) | +
Availability | +Windows, Linux, macOS | +
+
Gets the number of rows returned by a sql bulk copy
+Uses reflection to return the _rowsCopied private field value from a SqlBulkCopy object +see http://stackoverflow.com/questions/1188384/sqlbulkcopy-row-count-when-complete
+Get-BulkRowsCopiedCount
+ [[-BulkCopy] <SqlBulkCopy>]
+ [<CommonParameters>]
+
+
++
+
PS > Get-BulkRowsCopied $bulkObject
+Returns a integer containing the number of rows copied by SqlBulkCopy
The Bulk copy object to retrieve the rows copied field from +This is internal function is used by
++ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-BulkRowsCopiedCount on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-BulkRowsCopiedCount.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Converts Microsoft's code page ID to human readable format
+Converts Microsoft's code page ID to human readable format
+Get-CodePage
+ [[-id] <Int32>]
+ [<CommonParameters>]
+
+
++
+
PS > Get-CodePage 1252
+Returns a pscustomobject with id, alias and name
The code page ID
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
+
Want to see the source code for this command? Check out Get-CodePage on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-CodePage.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-ConnectionParent -InputObject
Get-ConnectionParent[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-ConnectionParent; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-ConnectionParent on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-ConnectionParent.
+ | + |
---|---|
Author | +Niphlod, https://github.com/niphlod | +
Availability | +Windows, Linux, macOS | +
+
Get-DbaADObject tries to facilitate searching AD with dbatools, which ATM can't require AD cmdlets.
+As working with multiple domains, forests, ldap filters, partitions, etc is quite hard to grasp, let's try to do "the right thing" here and +facilitate everybody's work with it. It either returns the exact matched result or None if it isn't found. You can inspect the raw object +calling GetUnderlyingObject() on the returned object.
+Get-DbaADObject
+ [[-ADObject] <String[]>]
+ [[-Type] <String>]
+ [[-IdentityType] <String>]
+ [[-Credential] <PSCredential>]
+ [-SearchAllDomains]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS > Get-DbaADObject -ADObject "contoso\ctrlb" -Type User
+Searches in the contoso domain for a ctrlb user
PS > Get-DbaADObject -ADObject "ctrlb@contoso.com" -Type User -IdentityType UserPrincipalName
+Searches in the contoso domain for a ctrlb user using the UserPrincipalName format. Again, beware of the UPN suffixes in elaborate AD structures!
PS > Get-DbaADObject -ADObject "contoso\ctrlb@super.contoso.com" -Type User -IdentityType UserPrincipalName
+Searches in the contoso domain for a ctrlb@super.contoso.com user using the UserPrincipalName format. This kind of search is better than the previous one
+because it takes into account possible UPN suffixes
PS > Get-DbaADObject -ADObject "ctrlb@super.contoso.com" -Type User -IdentityType UserPrincipalName -SearchAllDomains
+As a last resort, searches in all the current forest for a ctrlb@super.contoso.com user using the UserPrincipalName format
PS > Get-DbaADObject -ADObject "contoso\sqlcollaborative" -Type Group
+Searches in the contoso domain for a sqlcollaborative group
PS > Get-DbaADObject -ADObject "contoso\SqlInstance2014$" -Type Group
+Searches in the contoso domain for a SqlInstance2014 computer (remember the ending $ for computer objects)
PS > Get-DbaADObject -ADObject "contoso\ctrlb" -Type User -EnableException
+Searches in the contoso domain for a ctrlb user, suppressing all error messages and throw exceptions that can be caught instead
Pass in both the domain and the login name in Domain\sAMAccountName format (the one everybody is accustomed to)
+You can also pass a UserPrincipalName format (with the correct IdentityType, either with Domain\UserPrincipalName or UserPrincipalName@Domain)
+Beware: the "Domain" part of the UPN can be different from the real domain, see "UPN suffixes" (https://msdn.microsoft.com/en-us/library/windows/desktop/aa380525(v=vs.85).aspx)
+It's always best to pass the real domain name in (see the examples)
+For any other format, please beware that the domain part must always be specified (again, for the best result, before the slash)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
You should always know what you are asking for. Please pass in Computer,Group or User to help speeding up the search
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Accepted Values | +User,Group,Computer | +
By default objects are searched using sAMAccountName format, here you can pass different representation that need to match the passed in ADObject
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +SamAccountName | +
Accepted Values | +DistinguishedName,Guid,Name,SamAccountName,Sid,UserPrincipalName | +
Use this credential to connect to the domain and search for the needed ADObject. If not passed, uses the current process' one.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Search for the object in all domains connected to the current one. If you are unsure what domain the object is coming from,
+using this switch will search through all domains in your forest and also in the ones that are trusted. This is HEAVY, but it can save
+some headaches.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
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 | +
+
Want to see the source code for this command? Check out Get-DbaADObject on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DbaADObject.
+ | + |
---|---|
Author | +Simone Bizzotto | +
Availability | +Windows, Linux, macOS | +
+
Gets raw information about physical files linked to databases
+Fastest way to fetch just the paths of the physical files for every database on the instance, also for offline databases. +Incidentally, it also fetches the paths for MMO and FS filegroups. +This is partly already in Get-DbaDbFile, but this internal needs to stay lean and fast, as it's heavily used in top-level functions
+Get-DbaDbPhysicalFile
+ [-SqlInstance] <DbaInstanceParameter>
+ [[-SqlCredential] <PSCredential>]
+ [<CommonParameters>]
+
+
++
+
PS > Get-DbaDbPhysicalFile -SqlInstance server1\instance2
SMO object representing the SQL Server to connect to.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-DbaDbPhysicalFile on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DbaDbPhysicalFile.
+ | + |
---|---|
Author | +Ant Green (@ant_green) | +
Availability | +Windows, Linux, macOS | +
+
Gets database service broker queues
+Gets database Sservice broker queue
+Get-DbaDbServiceBrokerQueue
+ [[-SqlInstance] <DbaInstanceParameter[]>]
+ [[-SqlCredential] <PSCredential>]
+ [[-Database] <Object[]>]
+ [[-ExcludeDatabase] <Object[]>]
+ [-ExcludeSystemQueue]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Get-DbaDbServiceBrokerQueue -SqlInstance sql2016
+
+Gets all database service broker queues
PS C:\> Get-DbaDbServiceBrokerQueue -SqlInstance Server1 -Database db1
+
+Gets the service broker queues for the db1 database
PS C:\> Get-DbaDbServiceBrokerQueue -SqlInstance Server1 -ExcludeDatabase db1
+
+Gets the service broker queues for all databases except db1
PS C:\> Get-DbaDbServiceBrokerQueue -SqlInstance Server1 -ExcludeSystemQueue
+
+Gets the service broker queues for all databases that are not system objects
The target SQL Server instance or instances
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
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 | ++ |
To get service broker queues from specific database(s)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The database(s) to exclude - this list is auto populated from the server
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
This switch removes all system objects from the queue collection
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
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 | +
+
Want to see the source code for this command? Check out Get-DbaDbServiceBrokerQueue on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DbaDbServiceBrokerQueue.
+ | + |
---|---|
Author | +Stuart Moore (@napalmgram stuart-moore.com ) | +
Availability | +Windows, Linux, macOS | +
+
Returns basic information about Filestream folders from a Sql Instance
+Given a SQL Instance, and an optional list of databases returns the FileStream containing folders on that Instance. Without the Database parameter, all dbs with FileStream are returned
+Get-DbaFileStreamFolder
+ [[-SqlInstance] <DbaInstanceParameter>]
+ [[-SqlCredential] <PSCredential>]
+ [[-Database] <String[]>]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS > Get-DbaFileStreamFolder -SqlInstance server1\instance2
+Returns all FileStream folders from server1\instance2
PS > Get-DbaFileStreamFolder -SqlInstance server1\instance2 -Database Archive
+Returns any FileStream folders from the Archive database on server1\instance2
The Sql Server instance to be queries
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
A Sql Credential to connect to $SqlInstance
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Database to be tested, multiple databases may be specified as a comma seperated list.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | +
+
Want to see the source code for this command? Check out Get-DbaFileStreamFolder on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DbaFileStreamFolder.
+ | + |
---|---|
Author | +Simone Bizzotto (@niphlod) | +
Availability | +Windows, Linux, macOS | +
+
Massages inline help data to a more useful format
+Takes the inline help and outputs a more usable object
+Get-DbaHelp
+ [-Name] <String>
+ [[-OutputAs] <String>]
+ [<CommonParameters>]
+
+
++
+
PS > Get-DbaHelp Get-DbaDatabase
+Parses the inline help from Get-DbaDatabase and outputs the massaged object
PS > Get-DbaHelp Get-DbaDatabase -OutputAs "PSObject"
+Parses the inline help from Get-DbaDatabase and outputs the massaged object
PS C:\> Get-DbaHelp Get-DbaDatabase -OutputAs "MDString" | Out-File Get-DbaDatabase.md
+PS C:\> & code Get-DbaDatabase.md
+
+Parses the inline help from Get-DbaDatabase as MarkDown, saves the file and opens it
+via VSCode
The function/command to extract help from
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Output format (raw PSObject or MDString)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +PSObject | +
Accepted Values | +PSObject,MDString | +
+
Want to see the source code for this command? Check out Get-DbaHelp on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DbaHelp.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Returns all registered message level modifiers with similar name.
+Returns all registered message level modifiers with similar name.
+Message level modifiers are created using New-DbaMessageLevelModifier and allow dynamically modifying the actual message level written by commands.
+Get-DbaMessageLevelModifier
+ [[-Name] <String>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Get-DbaMessageLevelModifier
+
+Returns all message level filters
PS C:\> Get-DbaMessageLevelModifier -Name "mymodule.*"
+
+Returns all message level filters that start with "mymodule."
Default: "*"
+A name filter - only commands that are similar to the filter will be returned.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +* | +
+
Want to see the source code for this command? Check out Get-DbaMessageLevelModifier on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DbaMessageLevelModifier.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-DbaPathSep [-Server
Get-DbaPathSep[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-DbaPathSep; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-DbaPathSep on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DbaPathSep.
+ | + |
---|---|
Author | +Kirill Kravtsov ( @nvarscar ) | +
Availability | +Windows, Linux, macOS | +
+
Gets the SQL Server Reporting Services on a computer.
+Gets the SQL Server Reporting Services on one or more computers.
+Requires Local Admin rights on destination computer(s).
+Get-DbaReportingService
+ [[-ComputerName] <DbaInstanceParameter[]>]
+ [-InstanceName <String[]>]
+ [-Credential <PSCredential>]
+ [-ServiceName <String[]>]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Get-DbaReportingService -ComputerName sqlserver2014a
+
+Gets the Reporting Services on computer sqlserver2014a.
PS C:\> $cred = Get-Credential WindowsUser
+PS C:\> Get-DbaReportingService -ComputerName sql1,sql2 -Credential $cred | Out-GridView
+
+Gets the Reporting Services on computers sql1 and sql2 via the user WindowsUser, and shows them in a grid view.
PS C:\> Get-DbaReportingService -ComputerName sql1,sql2 -InstanceName MSSQLSERVER
+
+Gets the Reporting Services related to the default instance MSSQLSERVER on computers sql1 and sql2.
PS C:\> $MyServers = Get-Content .\servers.txt
+PS C:\> Get-DbaReportingService -ComputerName $MyServers -ServiceName MSSQLSERVER,SQLSERVERAGENT
+
+Gets the Reporting Services with ServiceName MSSQLSERVER or SQLSERVERAGENT for all the servers that are stored in the file. Every line in the file can only contain one hostname for a server.
PS C:\> $services = Get-DbaReportingService -ComputerName sql1
+PS C:\> $services.ChangeStartMode('Manual')
+
+Gets the Reporting Services on computer sql1 and changes their startup mode to 'Manual'.
PS C:\> (Get-DbaReportingService -ComputerName sql1).Restart($true)
+
+Calls a Restart method for each Reporting service on computer sql1.
The target SQL Server instance or instances.
+ | + |
---|---|
Alias | +cn,host,Server | +
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | +$env:COMPUTERNAME | +
Only returns services that belong to the specific instances.
+ | + |
---|---|
Alias | +Instance | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Credential object used to connect to the computer as a different user.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Can be used to specify service names explicitly, without looking for service types/instances.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | +
+
Want to see the source code for this command? Check out Get-DbaReportingService on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DbaReportingService.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Returns registered runspaces.
+Returns a list of runspaces that have been registered with dbatools
+Get-DbaRunspace
+ [[-Name] <String>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Get-DbaRunspace
+
+Returns all registered runspaces
PS C:\> Get-DbaRunspace -Name 'mymodule.maintenance'
+
+Returns the runspace registered under the name 'mymodule.maintenance'
Default: "*"
+Only registered runspaces of similar names are returned.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +* | +
+
Want to see the source code for this command? Check out Get-DbaRunspace on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DbaRunspace.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Returns the list of error code messages for Windows service management.
+Get-DbaServiceErrorMessage
+ [[-ErrorNumber] <Int32>]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | +0 | +
+
Want to see the source code for this command? Check out Get-DbaServiceErrorMessage on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DbaServiceErrorMessage.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function.
+This function is heavily based on Antti Rantasaari's script at http://goo.gl/wpqSib +Antti Rantasaari 2014, NetSPI +License: BSD 3-Clause http://opensource.org/licenses/BSD-3-Clause
+Get-DecryptedObject
+ [-SqlInstance] <Server>
+ [-Type] <String>
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Accepted Values | +LinkedServer,Credential | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Get-DecryptedObject on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DecryptedObject.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal Function to get SQL Server backfiles from a specified folder
+Takes path, checks for validity. Scans for usual backup file
+Get-DirectoryRestoreFile
+ [-Path] <String>
+ [-Recurse]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Get-DirectoryRestoreFile on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-DirectoryRestoreFile.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-ErrorMessage -Record
Get-ErrorMessage[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-ErrorMessage; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-ErrorMessage on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-ErrorMessage.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-ExportFilePath [-Path
Get-ExportFilePath[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-ExportFilePath; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-ExportFilePath on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-ExportFilePath.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Uses WMI/CIM to scan for the existance of a specific windows services.
+Uses WMI/CIM to scan for the existance of a specific windows services.
+Use Get-InternalService if you are interested in scanning for sql server services exclusively.
+Get-InternalService
+ [[-Name] <String[]>]
+ [[-DisplayName] <String[]>]
+ [[-ComputerName] <DbaInstanceParameter[]>]
+ [[-Credential] <PSCredential>]
+ [[-DoNotUse] {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS > Get-InternalService -Name LanmanServer
+Returns information on the LanmanServer service from localhost.
PS > Get-ADComputer -Filter * | Get-InternalService -Name Browser
+First retrieves all computer accounts from active directory, then scans all of those computers for the browser service.
+Note: THis may take seriously long time, you may also want to filter out computers that are offline before scanning for services.
PS > Get-InternalService -ComputerName "server1","server2","server3" -Name Lanman%
+Scans the servers server1, server2 and server3 for all services whose name starts with 'lanman'
The name of the service to search for.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The display-name of the service to search for.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The computer to target. Uses localhost by default.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | +$env:COMPUTERNAME | +
The credentials to use when connecting to the computer.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Connection Protocols that should not be used when retrieving the information.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | +
+
Want to see the source code for this command? Check out Get-InternalService on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-InternalService.
+ | + |
---|---|
Author | +Shawn Melton (@wsmelton) | +
Availability | +Windows, Linux, macOS | +
+
Helper function to get SQL Agent jobs.
+Helper function to get all SQL Agent jobs or provide filter
+Get-JobList
+ [[-SqlInstance] <DbaInstanceParameter>]
+ [[-SqlCredential] <PSCredential>]
+ [[-JobFilter] <String[]>]
+ [[-StepFilter] <String[]>]
+ [-Not]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS > Get-JobList -SqlInstance sql2016
+Returns the full JobServer.Jobs object found on sql2016
PS > Get-JobList -SqlInstance sql2016 -JobFilter 'job'
+Returns the Job object for each job name found to have "job" in the name on sql2016
PS > Get-JobList -SqlInstance sql2016 -JobFilter 'job' -Not
+Returns any Job object that does not have "job" in the name on sql2016
PS > Get-JobList -SqlInstance YourServer -JobFilter 'JobName'
+Returns the Job object where the job name is 'JobName' on sql2016
PS > Get-JobList -SqlInstance YourServer -JobFilter 'JobName' -Not
+Returns any Job object where the job name is not 'JobName' on sql2016
PS > Get-JobList -SqlInstance YourServer -JobFilter job_3_upload, job_3_download
+Returns the Job object for where job is job_3_upload or job_3_download on sql2016
PS > Get-JobList -SqlInstance YourServer -JobFilter job_3_upload, job_3_download -Not
+Returns any Job object where job is not job_3_upload or job_3_download on sql2016
SQL Server instance
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
Credential to use if SqlInstance did not include it.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Object of jobs to filter on, also supports wildcard patterns
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Object of job steps to filter on, also supports wildcard patterns
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Reverse results where object returned excludes filtered content.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
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 | +
+
Want to see the source code for this command? Check out Get-JobList on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-JobList.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Converts Microsoft's language ID to human readable format
+Converts Microsoft's language ID to human readable format
+Get-Language
+ [[-id] <Int32>]
+ [<CommonParameters>]
+
+
++
+
PS > Get-Language 1033
+Returns a pscustomobject with id, alias and name
The language ID
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
+
Want to see the source code for this command? Check out Get-Language on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-Language.
+ | + |
---|---|
Author | +Patrick Flynn (@sqllensman) | +
Availability | +Windows, Linux, macOS | +
+
Parse a one, two, or three part object name into seperate paths
+Takes a one, two or three part object name and splits them into Database, Schema and Name
+Get-ObjectNameParts
+ [[-ObjectName] <String>]
+ [<CommonParameters>]
+
+
++
+
PS > Get-ObjectNameParts -ObjectName 'table'
+Parses a three-part name into its constitute parts.
PS > Get-ObjectNameParts -ObjectName '[Bad. Name]]].[Schema.With.Dots]]].[Another .Silly]] Name..]'
+Parses a three-part name into its constitute parts. Uses square brackets to enclose special characters.
The object name to parse. You can specify a one, two, or three part object name.
+If the object has special characters they must be wrapped in square brackets [ ].
+If the name contains character ']' this must be escaped by duplicating the character
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-ObjectNameParts on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-ObjectNameParts.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Returns dictionary object that contains file structures for SQL databases.
+Get-OfflineSqlFileStructure
+ [-SqlInstance] <Object>
+ [-DbName] <String>
+ [-filelist] <Object>
+ [[-ReuseSourceFolderStructure] <Boolean>]
+ [-SqlCredential <PSCredential>]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-OfflineSqlFileStructure on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-OfflineSqlFileStructure.
+ | + |
---|---|
Author | +Kirill Kravtsov (@nvarscar) | +
Availability | +Windows, Linux, macOS | +
+
Generates a password hash for SQL Server login
+Generates a hash string based on the plaintext or securestring password and a SQL Server version. Salt is optional
+Get-PasswordHash
+ [[-Password] <Object>]
+ [[-SqlMajorVersion] <Object>]
+ [[-byteSalt] <Byte[]>]
+ [<CommonParameters>]
+
+
++
+
PS > Get-PasswordHash $securePassword 11
+Generates password hash for SQL 2012
PS > Get-PasswordHash $securePassword 9 $byte
+Generates password hash for SQL 2005 using custom salt from the $byte variable
Either plain text or Securestring password
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Major version of the SQL Server. Defines the hash algorithm.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Optional. Inserts custom salt into the hash instead of randomly generating new salt
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-PasswordHash on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-PasswordHash.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-RandomPassword [-Length
Get-RandomPassword[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-RandomPassword; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-RandomPassword on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-RandomPassword.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-RegServerGroupReverseParse [-object
Get-RegServerGroupReverseParse[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-RegServerGroupReverseParse; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-RegServerGroupReverseParse on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-RegServerGroupReverseParse.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-RegServerParent [-InputObject
Get-RegServerParent[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-RegServerParent; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-RegServerParent on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-RegServerParent.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-ResourceState [-state
Get-ResourceState[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-ResourceState; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-ResourceState on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-ResourceState.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Gets a list of databases from a SQL instance that are in a state for further restores
+Takes a SQL instance and checks for databases with a redo_start_lsn value, and returns the database name and that value +-gt SQl 2005 it comes from master.sys.master_files +-eq SQL 2000 DBCC DBINFO
+Get-RestoreContinuableDatabase
+ [-SqlInstance] <Object>
+ [[-SqlCredential] <PSCredential>]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Get-RestoreContinuableDatabase on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-RestoreContinuableDatabase.
+ | + |
---|---|
Author | +Kirill Kravtsov (@nvarscar) https://nvarscar.wordpress.com/ | +
Availability | +Windows, Linux, macOS | +
+
Retrieves SQL server information from a local or remote servers.
+Retrieves SQL server information from a local or remote servers. Pulls all instances from a SQL server and +detects if in a cluster or not.
+Get-SQLInstanceComponent
+ [[-ComputerName] <DbaInstanceParameter[]>]
+ [[-Component] <String[]>]
+ [[-Credential] <PSCredential>]
+ [<CommonParameters>]
+
+
++
+
PS > Get-SQLInstanceComponent -ComputerName SQL01 -Component SSDS
+ComputerName : BDT005-BT-SQL
+InstanceType : Database Engine
+InstanceName : MSSQLSERVER
+InstanceID : MSSQL11.MSSQLSERVER
+Edition : Enterprise Edition
+Version : 11.1.3000.0
+Caption : SQL Server 2012
+IsCluster : False
+IsClusterNode : False
+ClusterName :
+ClusterNodes :
+FullName : BDT005-BT-SQL
Retrieves the SQL instance information from SQL01 for component type SSDS (Database Engine).
PS > Get-SQLInstanceComponent -ComputerName SQL01
+ComputerName : BDT005-BT-SQL
+InstanceType : Analysis Services
+InstanceName : MSSQLSERVER
+InstanceID : MSAS11.MSSQLSERVER
+Edition : Enterprise Edition
+Version : 11.1.3000.0
+Caption : SQL Server 2012
+IsCluster : False
+IsClusterNode : False
+ClusterName :
+ClusterNodes :
+FullName : BDT005-BT-SQL
+ComputerName : BDT005-BT-SQL
+InstanceType : Reporting Services
+InstanceName : MSSQLSERVER
+InstanceID : MSRS11.MSSQLSERVER
+Edition : Enterprise Edition
+Version : 11.1.3000.0
+Caption : SQL Server 2012
+IsCluster : False
+IsClusterNode : False
+ClusterName :
+ClusterNodes :
+FullName : BDT005-BT-SQL
Retrieves the SQL instance information from SQL01 for all component types (SSAS, SSDS, SSRS).
Local or remote systems to query for SQL information.
+ | + |
---|---|
Alias | +Computer,DNSHostName,IPAddress | +
Required | +False | +
Pipeline | +true (ByValue, ByPropertyName) | +
Default Value | +$Env:COMPUTERNAME | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +@('SSDS', 'SSAS', 'SSRS') | +
Accepted Values | +SSDS,SSAS,SSRS | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-SQLInstanceComponent on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-SQLInstanceComponent.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Gets the login matching the standard "sa" user
+Gets the login matching the standard "sa" user, useful in case of renames
+Get-SaLoginName
+ [-SqlInstance] <Object>
+ [[-SqlCredential] <PSCredential>]
+ [<CommonParameters>]
+
+
++
+
PS > Get-SaLoginName -SqlInstance base\sql2016
The SQL Server instance.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Allows you to login to servers using SQL Logins instead of Windows Authentication (AKA Integrated or Trusted).
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-SaLoginName on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-SaLoginName.
+ | + |
---|---|
Author | +Richie lee (@bzzzt_io) | +
Availability | +Windows, Linux, macOS | +
+
Retrieves the values of PowerShell parameters and updates values of SqlmdVars listed in the publish.xml.
+Attempt to resolve SQLCmd variables via matching powershell variables explicitly defined in the current context. +To try and avoid 'bad' default values getting deployed, block a deployment if we have SqlCmd variables that aren't defined in current context. +Function has one reference and is executed when the "getSqlCmdVars" switch is included.
+Get-SqlCmdVars
+ [-SqlCommandVariableValues] <Object>
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS > Imagine content of MyDbProject.publish.xml is as follows -
+
+
+
+
+
+Timeout=60;Encrypt=False;TrustServerCertificate=True
+
+
+
+
+
+
+
+
+
+
+We will need one PowerShell parameter named $DeployTag to update the value
+The following scenario will fail as no $deployTag -
+"
+$publishXml = "C:\MyDbProject\bin\Debug\MyDbProject.publish.xml"
+$dacProfile = [Microsoft.SqlServer.Dac.DacProfile]::Load($publishXml)
+Get-SqlCmdVars $dacProfile.DeployOptions.SqlCommandVariableValues -EnableException
+"
+This scenario will pass.
+"
+$deployTag = "NewValue"
+$publishXml = "C:\MyDbProject\bin\Debug\MyDbProject.publish.xml"
+$dacProfile = [Microsoft.SqlServer.Dac.DacProfile]::Load($publishXml)
+Get-SqlCmdVars $dacProfile.DeployOptions.SqlCommandVariableValues -EnableException
+"
Mandatory. The SqlCommandVariableValues from the DeployOptions property in the Microsoft.SqlServer.Dac.DacProfile
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
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 | +
+
Want to see the source code for this command? Check out Get-SqlCmdVars on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-SqlCmdVars.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Returns the default data and log paths for SQL Server. Needed because SMO's server.defaultpath is sometimes null.
+Get-SqlDefaultPaths
+ [-SqlInstance] <Object>
+ [-filetype] <String>
+ [[-SqlCredential] <PSCredential>]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-SqlDefaultPaths on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-SqlDefaultPaths.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Returns the default sp_configure options for a given version of SQL Server.
+Get-SqlDefaultSpConfigure
+ [-SqlVersion] <Object>
+ [<CommonParameters>]
+
+
++
+
PS > Get-SqlDefaultSpConfigure -SqlVersion 11
+Returns a list of sp_configure (sys.configurations) items for SQL 2012.
+ | + |
---|---|
Alias | +Version | +
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-SqlDefaultSpConfigure on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-SqlDefaultSpConfigure.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Returns custom object that contains file structures on destination paths (\SqlInstance\m$\mssql\etc\etc\file.mdf) for +source and destination servers.
+Get-SqlFileStructure
+ [-source] <Object>
+ [-destination] <Object>
+ [-ReuseSourceFolderStructure <Boolean>]
+ [-SourceSqlCredential <PSCredential>]
+ [-DestinationSqlCredential <PSCredential>]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-SqlFileStructure on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-SqlFileStructure.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-SqlInstanceUpdate -ComputerName
Get-SqlInstanceUpdate -ComputerName
Get-SqlInstanceUpdate -ComputerName
Get-SqlInstanceUpdate[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-SqlInstanceUpdate; CommonParameters=True; parameter=System.Object[]}, @{name=
+
+Get-SqlInstanceUpdate; CommonParameters=True; parameter=System.Object[]}, @{name=
+
+Get-SqlInstanceUpdate; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Accepted Values | +ServicePack,CumulativeUpdate | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-SqlInstanceUpdate on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-SqlInstanceUpdate.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Gets the name of the sa login in case someone changed it.
+Get-SqlSaLogin
+ [-SqlInstance] <Object>
+ [[-SqlCredential] <PSCredential>]
+ [<CommonParameters>]
+
+
++
+
The SQL Server instance.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Allows you to login to servers using SQL Logins instead of Windows Authentication (AKA Integrated or Trusted).
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-SqlSaLogin on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-SqlSaLogin.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-WmiHadr -SqlInstance <DbaInstanceParameter[]> [-Credential
Get-WmiHadr[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-WmiHadr; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Get-WmiHadr on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-WmiHadr.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Get-XPlatVariable
+Get-XPlatVariable[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Get-XPlatVariable; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+
Want to see the source code for this command? Check out Get-XPlatVariable on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-XPlatVariable.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal Function to get SQL Server backfiles from a specified folder using xp_dirtree
+Takes path, checks for validity. Scans for usual backup file
+Get-XpDirTreeRestoreFile
+ [-Path] <String>
+ [-SqlInstance] <DbaInstanceParameter>
+ [[-SqlCredential] <PSCredential>]
+ [-EnableException]
+ [-NoRecurse]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Get-XpDirTreeRestoreFile -Path '\\foo\bar\' -SqlInstance $SqlInstance
+
+Tests whether the instance $SqlInstance has access to the path \foo\bar<br>
+The path to retrieve the restore for.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
The SQL Server that you're connecting to.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Credential object used to connect to the SQL Server as a different user
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Get-XpDirTreeRestoreFile on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Get-XpDirTreeRestoreFile.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Hide-ConnectionString [-ConnectionString
Hide-ConnectionString[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Hide-ConnectionString; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Hide-ConnectionString on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Hide-ConnectionString.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Loads a cmdlet into the current context.
+Loads a cmdlet into the current context. +This can be used to register a cmdlet during module import, making it easy to have hybrid modules publishing both cmdlets and functions. +Can also be used to register cmdlets written in PowerShell classes.
+Import-DbaCmdlet
+ [-Name] <String>
+ [-Type] <Type>
+ [[-HelpFile] <String>]
+ [[-Module] <PSModuleInfo>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Import-DbaCmdlet -Name Get-Something -Type ([GetSomethingCommand])
+
+Imports the Get-Something cmdlet into the current context.
PS C:\> Import-DbaCmdlet -Name Get-Something -Type ([GetSomethingCommand]) -Module (Get-Module PSReadline)
+
+Imports the Get-Something cmdlet into the PSReadline module.
The name of the cmdlet to register.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The type of the class implementing the cmdlet.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Path to the help XML containing the help for the cmdlet.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Module to inject the cmdlet into.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Import-DbaCmdlet on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Import-DbaCmdlet.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Helps import dbatools files according to configuration
+Helps import dbatools files according to configuration +Always dotsource this function!
+Import-ModuleFile
+ [[-Path] <Object>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Import-ModuleFile -Path $function.FullName
+
+Imports the file stored at '$function.FullName'
The full path to the file to import
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Import-ModuleFile on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Import-ModuleFile.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Configure local and remote computers to use Credssp protocol
+Enables both local and remote machine to participate in a Credssp session. +Local computer will be told to trust the Delegate (remote) computer. +Remote computer will be configured to act as a server and accept client connections from local computer.
+This function can be disabled by setting the value of configuration item "commands.initialize-credssp.bypass" to $true. +Configuration of CredSSP can and will be done by this command only from an elevated PowerShell session.
+Initialize-CredSSP
+ [-ComputerName] <String>
+ [-Credential <PSCredential>]
+ [-EnableException <Boolean>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Initialize-CredSSP MyRemoteComputer
+
+PS C:\> $cred = Get-Credential
+PS C:\> Initialize-CredSSP -ComputerName PC2 -Credential $cred
+
+Remote computer name
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
PSCredential object used for authentication
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | +
+
Want to see the source code for this command? Check out Initialize-CredSSP on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Initialize-CredSSP.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Invoke-Alter [-Object
Invoke-Alter[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Invoke-Alter; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Invoke-Alter on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-Alter.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Wrapper function that calls Invoke-Command and gracefully handles credentials.
+Wrapper function that calls Invoke-Command and gracefully handles credentials.
+Invoke-Command2
+ [[-ComputerName] <DbaInstanceParameter>]
+ [[-Credential] <Object>]
+ [[-ScriptBlock] <ScriptBlock>]
+ [[-ArgumentList] <Object[]>]
+ [[-InputObject] <Object[]>]
+ [[-Authentication] <String>]
+ [[-ConfigurationName] <String>]
+ [-UseSSL]
+ [-Raw]
+ [[-RequiredPSVersion] <Version>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Invoke-Command2 -ComputerName sql2014 -Credential $Credential -ScriptBlock { dir }
+
+Executes the scriptblock '' on the computer sql2014 using the credentials stored in $Credential.
+If $Credential is null, no harm done.
Default: $env:COMPUTERNAME
+The computer to invoke the scriptblock on.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +$env:COMPUTERNAME | +
The credentials to use.
+Can accept $null on older PowerShell versions, since it expects type object, not PSCredential
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The code to run on the targeted system
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Any arguments to pass to the scriptblock being run
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Object that could be used in the ScriptBlock as $Input.
+NOTE:
+The object will be de-serialized once passed through the remote pipeline.
+Some objects (like hashtables) do not support de-serialization.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
Choose an authentication to use for the connection
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +Default | +
Accepted Values | +Default,Basic,Negotiate,NegotiateWithImplicitCredential,Credssp,Digest,Kerberos | +
Name of the remote PSSessionConfiguration to use.
+Should be registered already using Register-PSSessionConfiguration or internal Register-RemoteSessionConfiguration.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Enables SSL
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +(Get-DbatoolsConfigValue -FullName 'PSRemoting.PsSession.UseSSL' -Fallback $false) | +
Passes through the raw return data, rather than prettifying stuff.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Verifies that remote Powershell version is meeting specified requirements.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Invoke-Command2 on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-Command2.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Invoke-CommandWithFallback [-ComputerName
Invoke-CommandWithFallback[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Invoke-CommandWithFallback; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Accepted Values | +Default,Basic,Negotiate,NegotiateWithImplicitCredential,Credssp,Digest,Kerberos | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Invoke-CommandWithFallback on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-CommandWithFallback.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Invoke-Create [-Object
Invoke-Create[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Invoke-Create; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Invoke-Create on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-Create.
+ | + |
---|---|
Author | +Chrissy LeMaire (@cl), netnerds.net | +
Availability | +Windows, Linux, macOS | +
+
Validates if a mirror is ready
+Validates if a mirror is ready
+Thanks to https://github.com/mmessano/PowerShell/blob/master/SQL-ConfigureDatabaseMirroring.ps1
+Invoke-DbMirrorValidation
+ [[-Primary] <DbaInstanceParameter>]
+ [[-PrimarySqlCredential] <PSCredential>]
+ [-Mirror] <DbaInstanceParameter[]>
+ [[-MirrorSqlCredential] <PSCredential>]
+ [[-Witness] <DbaInstanceParameter>]
+ [[-WitnessSqlCredential] <PSCredential>]
+ [[-Database] <String[]>]
+ [[-SharedPath] <String>]
+ [[-InputObject] <Database[]>]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS C:\> $params = @{
+
+ Primary = 'sql2017a'<br>
+ Mirror = 'sql2017b'<br>
+ MirrorSqlCredential = 'sqladmin'<br>
+ Witness = 'sql2019'<br>
+ Database = 'onthewall'<br>
+ SharedPath = '\\nas\sql\share'<br>
+}<br>
+
+PS C:\> Invoke-DbMirrorValidation @params
+
+Do things
SQL Server name or SMO object representing the mirror SQL Server.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
SQL Server name or SMO object representing the primary SQL Server.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Login to the primary instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Login to the target instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
SQL Server name or SMO object representing the witness SQL Server.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Login to the target instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The database or databases to mirror
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The network share where the backups will be
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Enables piping from Get-DbaDatabase
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
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 | +
+
Want to see the source code for this command? Check out Invoke-DbMirrorValidation on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-DbMirrorValidation.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Runs a T-SQL script.
+Runs a T-SQL script. It's a stripped down version of https://github.com/dataplat/Invoke-SqlCmd2 and adapted to use dbatools' facilities. +If you're looking for a public usable function, see Invoke-DbaQuery
+Invoke-DbaAsync
+ [-SQLConnection <ServerConnection>] -Query <String>
+ [-As <String>]
+ [-SqlParameter <PSObject[]>]
+ [-CommandType {Text | StoredProcedure | TableDirect}]
+ [-AppendServerInstance]
+ [-QueryTimeout <Int32>]
+ [-MessagesToOutput]
+ [-NoExec]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
Specifies one or more queries to be run. The queries can be Transact-SQL, XQuery statements, or sqlcmd commands. Multiple queries in a single batch may be separated by a semicolon.
+Do not specify the sqlcmd GO separator (or, use the ParseGo parameter). Escape any double quotation marks included in the string.
+Consider using bracketed identifiers such as [MyTable] instead of quoted identifiers such as "MyTable".
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Specifies an existing SQLConnection object to use in connecting to SQL Server.
+ | + |
---|---|
Alias | +Connection,Conn | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Specifies output type. Valid options for this parameter are 'DataSet', 'DataTable', 'DataRow', 'PSObject', 'PSObjectArray', and 'SingleValue'
+PSObject and PSObjectArray output introduces overhead but adds flexibility for working with results: http://powershell.org/wp/forums/topic/dealing-with-dbnull/
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +DataRow | +
Accepted Values | +DataSet,DataTable,DataRow,PSObject,PSObjectArray,SingleValue | +
Specifies a hashtable of parameters or output from New-DbaSqlParameter for parameterized SQL queries. http://blog.codinghorror.com/give-me-parameterized-sql-or-give-me-death/
+ | + |
---|---|
Alias | +SqlParameters | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Specifies the type of command represented by the query string. Default is Text
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +Text | +
If this switch is enabled, the SQL Server instance will be appended to PSObject and DataRow output.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Specifies the number of seconds before the queries time out.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
Use this switch to have on the output stream messages too (e.g. PRINT statements). Output will hold the resultset too. See examples for detail
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Use this switch to prepend SET NOEXEC ON and append SET NOEXEC OFF to each statement
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Invoke-DbaAsync on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-DbaAsync.
+ | + |
---|---|
Author | +Constantine Kokkinos (@mobileck https://constantinekokkinos.com) | +
Availability | +Windows, Linux, macOS | +
+
Utilizes the DBCC WRITEPAGE functionality to corrupt a specific database table for testing. In no uncertain terms, this is a non-production command. +This will absolutely break your databases and that is its only purpose. +Using DBCC WritePage will definitely void any support options for your database.
+This command can be used to verify your tests for corruption are successful, and to demo various scenarios for corrupting page data. +This command will take an instance and database (and optionally a table) and set the database to single user mode, corrupt either the specified table or the first table it finds, and returns it to multi-user.
+Invoke-DbaDbCorruption
+ [-SqlInstance] <DbaInstanceParameter>
+ [[-SqlCredential] <PSCredential>]
+ [-Database] <String>
+ [[-Table] <String>]
+ [-EnableException]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
PS > Invoke-DbaDbCorruption -SqlInstance sql2016 -Database containeddb
+Prompts for confirmation then selects the first table in database containeddb and corrupts it (by putting database into single user mode, writing to garbage to its first non-iam page, and returning
+it to multi-user.)
PS > Invoke-DbaDbCorruption -SqlInstance sql2016 -Database containeddb -Table Customers -Confirm:$false
+Does not prompt and immediately corrupts table customers in database containeddb on the sql2016 instance (by putting database into single user mode, writing to garbage to its first non-iam page, and
+returning it to multi-user.)
The SQL Server instance holding the databases to be removed.You must have sysadmin access and Server version must be SQL Server version 2000 or higher.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
The single database you would like to corrupt, this command does not support multiple databases (on purpose.)
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Login to the target instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The specific table you want corrupted, if you do not choose one, the first user table (alphabetically) will be chosen for corruption.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | +
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Invoke-DbaDbCorruption on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-DbaDbCorruption.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Invoke-DbaDiagnosticQueryScriptParser -filename
Invoke-DbaDiagnosticQueryScriptParser[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Invoke-DbaDiagnosticQueryScriptParser; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Invoke-DbaDiagnosticQueryScriptParser on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-DbaDiagnosticQueryScriptParser.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Runs wmi commands against a target system.
+Runs wmi commands against a target system. +Either directly or over PowerShell remoting.
+Invoke-ManagedComputerCommand
+ [-ComputerName] <DbaInstanceParameter>
+ [[-Credential] <PSCredential>]
+ [-ScriptBlock] <ScriptBlock>
+ [[-ArgumentList] <Object[]>]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
The target to run against. Must be resolvable.
+ | + |
---|---|
Alias | +Server | +
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The scriptblock to execute.
+Use $wmi to access the smo wmi object.
+Must not include a param block!
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Credentials to use when using PowerShell remoting.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The arguments to pass to your scriptblock.
+Access them within the scriptblock using the automatic variable $args
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Left in for legacy reasons. This command will throw no matter what
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Invoke-ManagedComputerCommand on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-ManagedComputerCommand.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Function to control parallel processing using runspaces
+Function to control parallel processing using runspaces
+Note that each runspace will not have access to variables and commands loaded in your session or in other runspaces by default.
+This behaviour can be changed with parameters.
+
+Invoke-Parallel
+ [-ScriptBlock <ScriptBlock>] -InputObject <PSObject>
+ [-ObjectName <String>]
+ [-Activity <String>]
+ [-Status <String>]
+ [-Parameter <PSObject>]
+ [-ImportVariables]
+ [-ImportModules]
+ [-ImportFunctions]
+ [-Throttle <Int32>]
+ [-SleepTimer <Int32>]
+ [-RunspaceTimeout <Int32>]
+ [-NoCloseOnTimeout]
+ [-MaxQueue <Int32>]
+ [-AppendLog]
+ [-LogFile <String>]
+ [-Quiet]
+ [<CommonParameters>]
+
+Invoke-Parallel
+ [-ScriptFile <Object>] -InputObject <PSObject>
+ [-ObjectName <String>]
+ [-Activity <String>]
+ [-Status <String>]
+ [-Parameter <PSObject>]
+ [-ImportVariables]
+ [-ImportModules]
+ [-ImportFunctions]
+ [-Throttle <Int32>]
+ [-SleepTimer <Int32>]
+ [-RunspaceTimeout <Int32>]
+ [-NoCloseOnTimeout]
+ [-MaxQueue <Int32>]
+ [-AppendLog]
+ [-LogFile <String>]
+ [-Quiet]
+ [<CommonParameters>]
+
+
++
+
PS > Each example uses Test-ForPacs.ps1 which includes the following code:
+param($computer)
+if(test-connection $computer -count 1 -quiet -BufferSize 16){
+$object = [pscustomobject] @{
+Computer=$computer;
+Available=1;
+Kodak=$(
+if((test-path "\\(computer\c\)\users\public\desktop\Kodak Direct View Pacs.url") -or (test-path "\\(computer\c\)\documents and settings\all users\desktop\Kodak Direct View Pacs.url")
+){"1"}else{"0"}
+)
+}
+}
+else{
+$object = [pscustomobject] @{
+Computer=$computer;
+Available=0;
+Kodak="NA"
+}
+}
+$object
PS > Invoke-Parallel -scriptfile C:\public\Test-ForPacs.ps1 -inputobject $(get-content C:\pcs.txt) -runspaceTimeout 10 -throttle 10
+Pulls list of PCs from C:\pcs.txt,
+Runs Test-ForPacs against each
+If any query takes longer than 10 seconds, it is disposed
+Only run 10 threads at a time
PS > Invoke-Parallel -scriptfile C:\public\Test-ForPacs.ps1 -inputobject c-is-ts-91, c-is-ts-95
+Runs against c-is-ts-91, c-is-ts-95 (-computername)
+Runs Test-ForPacs against each
PS > $stuff = [pscustomobject] @{
+ContentFile = "windows\system32\drivers\etc\hosts"
+Logfile = "C:\temp\log.txt"
+}
+$computers | Invoke-Parallel -parameter $stuff {
+\(contentFile = join-path "\\$_\c\)" $parameter.contentfile
+Get-Content $contentFile |
+set-content $parameter.logfile
+}
+This example uses the parameter argument. This parameter is a single object. To pass multiple items into the script block, we create a custom object (using a PowerShell v3 language) with properties
+we want to pass in.
+Inside the script block, $parameter is used to reference this parameter object. This example sets a content file, gets content from that file, and sets it to a predefined log file.
PS > $test = 5
+1..2 | Invoke-Parallel -ImportVariables {$_ * $test}
+Add variables from the current session to the session state. Without -ImportVariables $Test would not be accessible
PS > $test = 5
+1..2 | Invoke-Parallel {$_ * $Using:test}
+Reference a variable from the current session with the $Using:
Run script against these specified objects.
+ | + |
---|---|
Alias | +CN,__Server,IPAddress,Server,ComputerName | +
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
Scriptblock to run against all computers.
+You may use $Using:
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
File to run against all input objects. Must include parameter to take in the input object, or use $args. Optionally, include parameter to take in parameter. Example: C:\script.ps1
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +input objects | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +Running Query | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +Starting threads | +
This object is passed to every script block. You can use it to pass information to the script block; for example, the path to a logging folder
+Reference this object as $parameter if using the scriptblock parameterset.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
If specified, get user session variables and add them to the initial session state
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
If specified, get loaded modules and pssnapins, add them to the initial session state
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Maximum number of threads to run at a single time.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +20 | +
Milliseconds to sleep after checking for completed runspaces and in a few other spots. I would not recommend dropping below 200 or increasing above 500
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +200 | +
Maximum time in seconds a single thread can run. If execution of your code takes longer than this, it is disposed. Default: 0 (seconds)
+WARNING: Using this parameter requires that maxQueue be set to throttle (it will be by default) for accurate timing. Details here:
+http://gallery.technet.microsoft.com/Run-Parallel-Parallel-377fd430
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
Do not dispose of timed out tasks or attempt to close the runspace if threads have timed out. This will prevent the script from hanging in certain situations where threads become non-responsive, at
+the expense of leaking memory within the PowerShell host.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Maximum number of powershell instances to add to runspace pool. If this is higher than $throttle, $timeout will be inaccurate
+If this is equal or less than throttle, there will be a performance impact
+The default value is $throttle times 3, if $runspaceTimeout is not specified
+The default value is $throttle, if $runspaceTimeout is specified
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
Append to existing log
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Path to a file where we can log results, including run time for each thread, whether it completes, completes with errors, or times out.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Disable progress bar
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Invoke-Parallel on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-Parallel.
+ | + |
---|---|
Author | +Kirill Kravtsov (@nvarscar) https://nvarscar.wordpress.com/ | +
Availability | +Windows, Linux, macOS | +
+
Invokes a remote execution of a file using specific credentials.
+Based on https://github.com/adbertram/PSSqlUpdater +Invokes a remote execution of a file passing credentials over the network to avoid a double-hop issue +and gain privileges necessary to execute any kind of executables.
+First it tries to initialize a CredSSP connection by configuring both Client and Server to run CredSSP connections.
+If CredSSP connection fails, it falls back to a less secure PSSessionConfiguration workaround, which registers +a temporary session configuration on a target machine (PS3.0+) and re-creates current PSSession to use remote +configuration by default.
+Invoke-Program
+ [-Path] <String>
+ [[-ComputerName] <DbaInstanceParameter>]
+ [[-Credential] <PSCredential>]
+ [[-ArgumentList] <String[]>]
+ [[-Authentication] <String>]
+ [[-ExpandStrings] <Boolean>]
+ [[-WorkingDirectory] <String>]
+ [[-SuccessReturnCode] <UInt32[]>]
+ [-Raw]
+ [-Fallback]
+ [[-EnableException] <Boolean>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Invoke-Program -ComputerName ServerA -Credentials $cred -Path "C:\temp\setup.exe" -ArgumentList '/quiet' -WorkingDirectory 'C:'
+
+Starts "setup.exe /quiet" on ServerA under provided credentials. C:\ will be set as a working directory.
PS C:\> Invoke-Program -ComputerName ServerA -Credentials $cred -Authentication Credssp -Path "C:\temp\setup.exe" -Fallback
+
+Starts "setup.exe" on ServerA under provided credentials. Will use CredSSP as a fisrt attempted protocol and then fallback to the PSSessionConfiguration workaround.
Path to the executable
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Remote computer name
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +$env:COMPUTERNAME | +
Credential object that will be used for authentication
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
List of arguments to pass to the executable
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Choose authentication mechanism to use
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +Default | +
Accepted Values | +Default,Basic,Negotiate,NegotiateWithImplicitCredential,Credssp,Digest,Kerberos | +
The strings in ArgumentList and WorkingDirectory will be evaluated remotely on a target machine.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Working directory for the process
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Return codes that will be acknowledged as successful execution. Defaults to 0 (success), 3010 (restart required)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +@(0, 3010) | +
Return plain stdout without any additional information
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
When credentials are specified, it is possible that the chosen protocol would fail to connect with them.
+Fallback will use PSSessionConfiguration to create a session configuration on a remote machine that uses
+provided set of credentials by default.
+Not a default option since it transfers credentials over a potentially unsecure network.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
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 | +$EnableException | +
+
Want to see the source code for this command? Check out Invoke-Program on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-Program.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Checks for PowerShell SMO version vs SQL Server's SMO version.
+Invoke-SmoCheck
+ [-SqlInstance] <Object>
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Invoke-SmoCheck on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-SmoCheck.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Allows using steppable pipelines on the pipeline.
+Allows using steppable pipelines on the pipeline.
+Invoke-SteppablePipeline
+ [[-InputObject] <Object>]
+ [-Pipeline] <Object>
+ [<CommonParameters>]
+
+
++
+
PS C:\> Get-ChildItem | Invoke-SteppablePipeline -Pipeline $steppablePipeline
+
+Processes the object returned by Get-ChildItem in the pipeline defined
The pipeline to execute
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The object(s) to process
+Should only receive input from the pipeline!
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Invoke-SteppablePipeline on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-SteppablePipeline.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
An internal command, feel free to ignore.
+Invoke-TagCommand
+ [[-Tag] <String>]
+ [[-Keyword] <String>]
+ [<CommonParameters>]
+
+
++
+
PS > Tag-Command -Tag Restore -Keyword Restore
+Tag-Command -Tag Backup -Keyword Backup
+Tag-Command -Tag Orphan -Keyword Orphan
+Tag-Command -Tag DisasterRecovery -Keyword Attach
+Tag-Command -Tag DisasterRecovery -Keyword Detach
+Tag-Command -Tag Snapshot -Keyword Snapshot
+Tag-Command -Tag Memory -Keyword Memory
+Tag-Command -Tag DisasterRecovery -Keyword Restore
+Tag-Command -Tag DisasterRecovery -Keyword Backup
+Tag-Command -Tag Storage -Keyword disk
+Tag-Command -Tag Storage -Keyword storage
+Tag-Command -Tag Migration -Keyword "Copy-"
+Tag-Command -Tag SPN -Keyword Kerberos
+Tag-Command -Tag SPN -Keyword SPN
+Tag-Command -Tag CIM -Keyword CimSession
+Tag-Command -Tag SQLWMI -Keyword Invoke-ManagedComputerCommand
+Tag-Command -Tag WSMan -Keyword Invoke-Command
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Invoke-TagCommand on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-TagCommand.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Invoke-TlsRestMethod
+Invoke-TlsRestMethod[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Invoke-TlsRestMethod; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+
Want to see the source code for this command? Check out Invoke-TlsRestMethod on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-TlsRestMethod.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Invoke-TlsWebRequest
+Invoke-TlsWebRequest[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Invoke-TlsWebRequest; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+
Want to see the source code for this command? Check out Invoke-TlsWebRequest on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Invoke-TlsWebRequest.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Parses a path to make it an admin UNC.
+Join-AdminUnc
+ [-servername] <String>
+ [-filepath] <String>
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Join-AdminUnc on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Join-AdminUnc.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Join-SomePath [-Path
Join-SomePath[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Join-SomePath; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Join-SomePath on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Join-SomePath.
+ | + |
---|---|
Author | +Adam Lancaster https://github.com/lancasteradam | +
Availability | +Windows, Linux, macOS | +
+
Creates a new linked server.
+Creates a new linked server. See the Microsoft documentation for sp_addlinkedserver for more details on the parameters.
+New-DbaLinkedServer
+ [[-SqlInstance] <DbaInstanceParameter[]>]
+ [[-SqlCredential] <PSCredential>]
+ [[-LinkedServer] <String>]
+ [[-ServerProduct] <String>]
+ [[-Provider] <String>]
+ [[-DataSource] <String>]
+ [[-Location] <String>]
+ [[-ProviderString] <String>]
+ [[-Catalog] <String>]
+ [[-SecurityContext] <String>]
+ [[-SecurityContextRemoteUser] <String>]
+ [[-SecurityContextRemoteUserPassword] <SecureString>]
+ [[-InputObject] <Server[]>]
+ [-EnableException]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
PS C:\> New-DbaLinkedServer -SqlInstance sql01 -LinkedServer linkedServer1 -ServerProduct mssql -Provider sqlncli -DataSource sql02
+
+Creates a new linked server named linkedServer1 on the sql01 instance. The link is via the SQL Native Client and is connected to the sql02 instance.
PS C:\> Connect-DbaInstance -SqlInstance sql01 | New-DbaLinkedServer -LinkedServer linkedServer1 -ServerProduct mssql -Provider sqlncli -DataSource sql02
+
+Creates a new linked server named linkedServer1 on the sql01 instance. The link is via the SQL Native Client and is connected to the sql02 instance. The sql01 instance is passed in via pipeline.
PS C:\> New-DbaLinkedServer -SqlInstance sql01 -LinkedServer linkedServer1 -ServerProduct mssql -Provider sqlncli -DataSource sql02 -SecurityContext CurrentSecurityContext
+
+Creates a new linked server named linkedServer1 on the sql01 instance. The link is via the SQL Native Client and is connected to the sql02 instance. Connections with logins that are not explicitly
+mapped to the remote server will use the current login's security context.
The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function
+to be executed against multiple SQL Server instances.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | ++ |
The name of the linked server.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The product name of the data source.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The unique ID of the provider.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The name of the data source.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The location of the database.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The provider connection string.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The catalog or default database.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Specifies the security context option found on the SSMS Security tab of the linked server. This is a separate configuration from the mapping of a local login to a remote login. It specifies the
+connection behavior for a login that is not explicitly mapped. 'NoConnection' means that a connection will not be made. 'WithoutSecurityContext' means the connection will be made without using a
+security context. 'CurrentSecurityContext' means the connection will be made using the login's current security context. 'SpecifiedSecurityContext' means the specified username and password will be
+used. The default value is 'WithoutSecurityContext'. For more details see the Microsoft documentation for sp_addlinkedsrvlogin and also review the SSMS Security tab of the linked server.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +WithoutSecurityContext | +
Accepted Values | +NoConnection,WithoutSecurityContext,CurrentSecurityContext,SpecifiedSecurityContext | +
Specifies the remote login name. This param is used when SecurityContext is set to SpecifiedSecurityContext. To map a local login to a remote login use New-DbaLinkedServerLogin.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Specifies the remote login password. This param is used when SecurityContext is set to SpecifiedSecurityContext. To map a local login to a remote login use New-DbaLinkedServerLogin. NOTE: passwords
+are sent to the SQL Server instance in plain text. Check with your security administrator before using this parameter.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Allows piping from Connect-DbaInstance.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
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 | +
Shows what would happen if the command were to run. No actions are actually performed.
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Prompts you for confirmation before executing any changing operations within the command.
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out New-DbaLinkedServer on GitHub.
+
+Want to see the Bill Of Health for this command? Check out New-DbaLinkedServer.
+ | + |
---|---|
Author | +Sander Stad (@sqlstad, sqlstad.nl) | +
Availability | +Windows, Linux, macOS | +
+
New-DbaLogShippingPrimaryDatabase add the primary database to log shipping
+New-DbaLogShippingPrimaryDatabase will add the primary database to log shipping. +This is executed on the primary server.
+New-DbaLogShippingPrimaryDatabase
+ [-SqlInstance] <Object>
+ [[-SqlCredential] <PSCredential>]
+ [-Database] <Object>
+ [-BackupDirectory] <String>
+ [-BackupJob] <String>
+ [-BackupRetention] <Int32>
+ [-BackupShare] <String>
+ [[-BackupThreshold] <Int32>]
+ [-CompressBackup]
+ [[-ThresholdAlert] <Int32>]
+ [[-HistoryRetention] <Int32>]
+ [[-MonitorServer] <String>]
+ [[-MonitorServerSecurityMode] <Object>]
+ [[-MonitorCredential] <PSCredential>]
+ [-ThresholdAlertEnabled]
+ [-EnableException]
+ [-Force]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
PS > New-DbaLogShippingPrimaryDatabase -SqlInstance sql1 -Database DB1 -BackupDirectory D:\data\logshipping -BackupJob LSBackup_DB1 -BackupRetention 4320 -BackupShare "\sql1\logshipping"
+-BackupThreshold 60 -CompressBackup -HistoryRetention 14420 -MonitorServer sql1 -ThresholdAlertEnabled
SQL Server instance. You must have sysadmin access and server version must be SQL Server version 2000 or greater.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Database to set up log shipping for.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Is the path to the backup folder on the primary server.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Is the name of the SQL Server Agent job on the primary server that copies the backup into the backup folder.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Is the length of time, in minutes, to retain the log backup file in the backup directory on the primary server.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | +0 | +
Is the network path to the backup directory on the primary server.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Login to the target instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Is the length of time, in minutes, after the last backup before a threshold_alert error is raised.
+The default is 60.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +60 | +
Enables the use of backup compression
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Is the length of time, in minutes, when the alert is to be raised when the backup threshold is exceeded.
+The default is 14,420.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +14420 | +
Is the length of time in minutes in which the history will be retained.
+The default is 14420.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +14420 | +
Is the name of the monitor server.
+The default is the name of the primary server.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The security mode used to connect to the monitor server. Allowed values are 0, "sqlserver", 1, "windows"
+The default is 1 or Windows.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +1 | +
Accepted Values | +0,sqlserver,1,windows | +
Allows you to login to enter a secure credential.
+This is only needed in combination with MonitorServerSecurityMode having either a 0 or 'sqlserver' value.
+To use: $scred = Get-Credential, then pass $scred object to the -MonitorCredential parameter.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Specifies whether an alert will be raised when backup threshold is exceeded.
+The default is 0.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
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 | +
The force parameter will ignore some errors in the parameters and assume defaults.
+It will also remove the any present schedules with the same name for the specific job.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Shows what would happen if the command were to run. No actions are actually performed.
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Prompts you for confirmation before executing any changing operations within the command.
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out New-DbaLogShippingPrimaryDatabase on GitHub.
+
+Want to see the Bill Of Health for this command? Check out New-DbaLogShippingPrimaryDatabase.
+ | + |
---|---|
Author | +Sander Stad (@sqlstad, sqlstad.nl) | +
Availability | +Windows, Linux, macOS | +
+
New-DbaLogShippingPrimarySecondary adds an entry for a secondary database.
+New-DbaLogShippingPrimarySecondary adds an entry for a secondary database. +This is executed on the primary server.
+New-DbaLogShippingPrimarySecondary
+ [-SqlInstance] <DbaInstanceParameter>
+ [[-SqlCredential] <PSCredential>]
+ [-PrimaryDatabase] <Object>
+ [-SecondaryDatabase] <Object>
+ [-SecondaryServer] <DbaInstanceParameter>
+ [[-SecondarySqlCredential] <PSCredential>]
+ [-EnableException]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
PS > New-DbaLogShippingPrimarySecondary -SqlInstance sql1 -PrimaryDatabase DB1 -SecondaryServer sql2 -SecondaryDatabase DB1_DR
SQL Server instance. You must have sysadmin access and server version must be SQL Server version 2000 or greater.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Is the name of the database on the primary server.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Is the name of the secondary database.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Is the name of the secondary server.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Login to the target instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Allows you to login to servers using SQL Logins as opposed to Windows Auth/Integrated/Trusted. To use:
+$scred = Get-Credential, then pass $scred object to the -SecondarySqlCredential parameter.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | +
Shows what would happen if the command were to run. No actions are actually performed.
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Prompts you for confirmation before executing any changing operations within the command.
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out New-DbaLogShippingPrimarySecondary on GitHub.
+
+Want to see the Bill Of Health for this command? Check out New-DbaLogShippingPrimarySecondary.
+ | + |
---|---|
Author | +Sander Stad (@sqlstad, sqlstad.nl) | +
Availability | +Windows, Linux, macOS | +
+
New-DbaLogShippingSecondaryDatabase sets up a secondary databases for log shipping.
+New-DbaLogShippingSecondaryDatabase sets up a secondary databases for log shipping. +This is executed on the secondary server.
+New-DbaLogShippingSecondaryDatabase
+ [-SqlInstance] <DbaInstanceParameter>
+ [[-SqlCredential] <PSCredential>]
+ [[-BufferCount] <Int32>]
+ [[-BlockSize] <Int32>]
+ [-DisconnectUsers]
+ [[-HistoryRetention] <Int32>]
+ [[-MaxTransferSize] <Int32>]
+ [-PrimaryServer] <DbaInstanceParameter>
+ [[-PrimarySqlCredential] <PSCredential>]
+ [-PrimaryDatabase] <Object>
+ [[-RestoreAll] <Int32>]
+ [[-RestoreDelay] <Int32>]
+ [[-RestoreMode] <Object>]
+ [-RestoreThreshold] <Int32>
+ [-SecondaryDatabase] <Object>
+ [[-ThresholdAlert] <Int32>]
+ [-ThresholdAlertEnabled]
+ [[-MonitorServer] <String>]
+ [[-MonitorServerSecurityMode] <Object>]
+ [[-MonitorCredential] <PSCredential>]
+ [-EnableException]
+ [-Force]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
PS > New-DbaLogShippingSecondaryDatabase -SqlInstance sql2 -SecondaryDatabase DB1_DR -PrimaryServer sql1 -PrimaryDatabase DB1 -RestoreDelay 0 -RestoreMode standby -DisconnectUsers -RestoreThreshold
+45 -ThresholdAlertEnabled -HistoryRetention 14420
SQL Server instance. You must have sysadmin access and server version must be SQL Server version 2000 or greater.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The name of the primary instance of the Microsoft SQL Server Database Engine in the log shipping configuration.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Is the name of the database on the primary server.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The number of minutes allowed to elapse between restore operations before an alert is generated.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | +0 | +
Is the name of the secondary database.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Login to the target instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The total number of buffers used by the backup or restore operation.
+The default is -1.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +-1 | +
The size, in bytes, that is used as the block size for the backup device.
+The default is -1.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +-1 | +
If set to 1, users are disconnected from the secondary database when a restore operation is performed.
+Te default is 0.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Is the length of time in minutes in which the history is retained.
+The default is 14420.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +14420 | +
The size, in bytes, of the maximum input or output request which is issued by SQL Server to the backup device.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
If set to 1, the secondary server restores all available transaction log backups when the restore job runs.
+The default is 1.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +1 | +
The amount of time, in minutes, that the secondary server waits before restoring a given backup file.
+The default is 0.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
The restore mode for the secondary database. The default is 0.
+0 = Restore log with NORECOVERY.
+1 = Restore log with STANDBY.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
Accepted Values | +0,NoRecovery,1,Standby | +
Is the alert to be raised when the backup threshold is exceeded.
+The default is 14420.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +14420 | +
Specifies whether an alert is raised when backup_threshold is exceeded.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Is the name of the monitor server.
+The default is the name of the primary server.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The security mode used to connect to the monitor server. Allowed values are 0, "sqlserver", 1, "windows"
+The default is 1 or Windows.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +1 | +
Accepted Values | +0,sqlserver,1,windows | +
Allows you to login to enter a secure credential.
+This is only needed in combination with MonitorServerSecurityMode having either a 0 or 'sqlserver' value.
+To use: $scred = Get-Credential, then pass $scred object to the -MonitorCredential parameter.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | +
The force parameter will ignore some errors in the parameters and assume defaults.
+It will also remove the any present schedules with the same name for the specific job.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Shows what would happen if the command were to run. No actions are actually performed.
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Prompts you for confirmation before executing any changing operations within the command.
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out New-DbaLogShippingSecondaryDatabase on GitHub.
+
+Want to see the Bill Of Health for this command? Check out New-DbaLogShippingSecondaryDatabase.
+ | + |
---|---|
Author | +Sander Stad (@sqlstad, sqlstad.nl) | +
Availability | +Windows, Linux, macOS | +
+
New-DbaLogShippingPrimarySecondary sets up the primary information for the primary database.
+New-DbaLogShippingPrimarySecondary sets up the primary information, adds local and remote monitor links, +and creates copy and restore jobs for the specified primary database. +This is executed on the secondary server.
+New-DbaLogShippingSecondaryPrimary
+ [-SqlInstance] <Object>
+ [[-SqlCredential] <PSCredential>]
+ [-BackupSourceDirectory] <String>
+ [[-BackupDestinationDirectory] <String>]
+ [-CopyJob] <String>
+ [[-FileRetentionPeriod] <Int32>]
+ [[-MonitorServer] <String>]
+ [[-MonitorCredential] <PSCredential>]
+ [-MonitorServerSecurityMode] <Object>
+ [[-PrimaryServer] <Object>]
+ [[-PrimarySqlCredential] <PSCredential>]
+ [[-PrimaryDatabase] <Object>]
+ [-RestoreJob] <String>
+ [-EnableException]
+ [-Force]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
PS > New-DbaLogShippingSecondaryPrimary -SqlInstance sql2 -BackupSourceDirectory "\sql1\logshipping\DB1" -BackupDestinationDirectory D:\Data\logshippingdestination\DB1_DR -CopyJob LSCopy_sql2_DB1_DR
+-FileRetentionPeriod 4320 -MonitorServer sql2 -MonitorServerSecurityMode 'Windows' -PrimaryServer sql1 -PrimaryDatabase DB1 -RestoreJob LSRestore_sql2_DB1_DR
SQL Server instance. You must have sysadmin access and server version must be SQL Server version 2000 or greater.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The directory where transaction log backup files from the primary server are stored.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The name to use for the SQL Server Agent job being created to copy transaction log backups to the secondary server.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The security mode used to connect to the monitor server. Allowed values are 0, "sqlserver", 1, "windows"
+The default is 1 or Windows.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | +1 | +
Accepted Values | +0,sqlserver,1,windows | +
Is the name of the SQL Server Agent job on the secondary server that restores the backups to the secondary database.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Login to the target instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The directory on the secondary server where backup files are copied to.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The length of time, in minutes, that a backup file is retained on the secondary server in the path specified by the BackupDestinationDirectory parameter before being deleted.
+The default is 14420.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +14420 | +
Is the name of the monitor server. The default is the secondary server.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The name of the primary instance of the Microsoft SQL Server Database Engine in the log shipping configuration.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Is the name of the database on the primary server.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | +
The force parameter will ignore some errors in the parameters and assume defaults.
+It will also remove the any present schedules with the same name for the specific job.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Shows what would happen if the command were to run. No actions are actually performed.
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Prompts you for confirmation before executing any changing operations within the command.
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out New-DbaLogShippingSecondaryPrimary on GitHub.
+
+Want to see the Bill Of Health for this command? Check out New-DbaLogShippingSecondaryPrimary.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Allows modifying message levels by powerful filters.
+Allows modifying message levels by powerful filters.
+This is designed to allow a developer to have more control over what is written how during the development process. +It also allows a debug user to fine tune what he is shown.
+This functionality is NOT designed for default implementation within a module. +Instead, set healthy message levels for your own messages and leave others to tend to their own levels.
+Note: +Adding too many level modifiers may impact performance, use with discretion.
+New-DbaMessageLevelModifier
+ [-Name] <String>
+ [-Modifier] <Int32>
+ [[-IncludeFunctionName] <String>]
+ [[-ExcludeFunctionName] <String>]
+ [[-IncludeModuleName] <String>]
+ [[-ExcludeModuleName] <String>]
+ [[-IncludeTags] <String[]>]
+ [[-ExcludeTags] <String[]>]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS C:\> New-DbaMessageLevelModifier -Name 'MyModule-Include' -Modifier -9 -IncludeModuleName MyModule
+PS C:\> New-DbaMessageLevelModifier -Name 'MyModule-Exclude' -Modifier 9 -ExcludeModuleName MyModule
+
+These settings will cause all messages from the module 'MyModule' to be highly prioritized and almost certainly written to host.
+It will also make it highly unlikely, that messages from other modules will even be considered for anything but the lowest level.
+This is useful when prioritizing your own module during development.
The name of the level modifier.
+Can be arbitrary, but must be unique. Not case sensitive.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The level modifier to apply.
++ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | +0 | +
Only messages from functions with one of these exact names will be considered.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Messages from functions with one of these exact names will be ignored.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Only messages from modules with one of these exact names will be considered.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Messages from module with one of these exact names will be ignored.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Only messages that contain one of these tags will be considered.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Messages that contain one of these tags will be ignored.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
This parameters disables user-friendly warnings and enables the throwing of exceptions.
+This is less user friendly, but allows catching exceptions in calling scripts.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out New-DbaMessageLevelModifier on GitHub.
+
+Want to see the Bill Of Health for this command? Check out New-DbaMessageLevelModifier.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
New-SqlConnection [-SqlInstance
New-SqlConnection[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+New-SqlConnection; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out New-SqlConnection on GitHub.
+
+Want to see the Bill Of Health for this command? Check out New-SqlConnection.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Reads a configuration file and parses it.
+Reads a configuration file and parses it.
+Read-DbatoolsConfigFile -Path <String>
+ [<CommonParameters>]
+
+Read-DbatoolsConfigFile -Weblink <String>
+ [<CommonParameters>]
+
+Read-DbatoolsConfigFile -RawJson <String>
+ [<CommonParameters>]
+
+
++
+
PS C:\> Read-DbatoolsConfigFile -Path config.json
+
+Reads the config.json file and returns interpreted configuration objects.
The path to the file to parse.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The link to a website to download straight as raw json.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Raw json data to interpret.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Read-DbatoolsConfigFile on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Read-DbatoolsConfigFile.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Reads configurations from persisted file / registry.
+Reads configurations from persisted file / registry.
+Read-DbatoolsConfigPersisted
+ [[-Scope] {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}]
+ [[-Module] <String>]
+ [[-ModuleVersion] <Int32>]
+ [[-Hashtable] <Hashtable>]
+ [-Default]
+ [<CommonParameters>]
+
+
++
+
PS > Read-DbatoolsConfigPersisted -Scope 127
+Read all persisted default configuration items in the default mandated order.
Where to read from.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Load module specific data.
+Use this to load on-demand configuration only when the module is imported.
+Useful when using the config system as cache.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The configuration version of the module-settings to load.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +1 | +
Rather than returning results, insert them into this hashtable.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
When inserting into a hashtable, existing values are overwritten by default.
+Enabling this setting will cause it to only insert values if the key does not exist yet.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Read-DbatoolsConfigPersisted on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Read-DbatoolsConfigPersisted.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Allows scheduling maintenance tasks, that are perfomed in the background.
+Allows scheduling maintenance tasks, that are perfomed in the background.
+All scriptblocks scheduled like this will be performed on a separate runspace and have access to all internal dbatools commands. +None of the scriptblocks will affect the main session (so you cannot manipulate variables, etc.)
+Register-DbaMaintenanceTask -Name <String> -ScriptBlock <ScriptBlock> -Once
+ [-Delay <TimeSpan>]
+ [-Priority {Trivial | Low | Medium | High | Critical}]
+ [-EnableException]
+ [<CommonParameters>]
+
+Register-DbaMaintenanceTask -Name <String> -ScriptBlock <ScriptBlock> -Interval <TimeSpan>
+ [-Delay <TimeSpan>]
+ [-Priority {Trivial | Low | Medium | High | Critical}]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Register-DbaMaintenanceTask -Name 'value1' -ScriptBlock $ScriptBlock -Once
+
+The name of the task.
+Must be unique, otherwise it will update the existing task.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The task/scriptblock that should be performed as part of the maintenance.
+It will have all of dbatools including internal commands available.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Whether the interval should be performed only once.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | +False | +
The interval at which the task should be repeated.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
How far after the initial registration should the maintenance script wait before processing this.
+This can be used to delay background stuff that should not content with items that would be good to have as part of the module import.
+Some library specific items can be moved to maintenance if their processing would take too much time on original import, even if it is desirable to have them available as soon as possible.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
How important is this task?
+If multiple tasks are due at the same maintenance cycle, the more critical one will be processed first.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +Medium | +
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 | +
+
Want to see the source code for this command? Check out Register-DbaMaintenanceTask on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Register-DbaMaintenanceTask.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Registers an event to when a message is written.
+Registers an event to when a message is written. +These events will fire whenever the written message fulfills the specified filter criteria.
+This allows integrating direct alerts and reactions to messages as they occur.
+Warnings:
+It is recommended to push processing that involves outside resources to a separate runspace, then use the event to pass the object as trigger. +The TaskEngine component may prove to be just what is needed to accomplish this.
+Register-DbaMessageEvent -Name <String> -ScriptBlock <ScriptBlock>
+ [-MessageFilter <String>]
+ [-ModuleNameFilter <String>]
+ [-FunctionNameFilter <String>]
+ [-TargetFilter <Object>]
+ [-LevelFilter {Critical | Important | Output | Significant | VeryVerbose | Verbose | SomewhatVerbose | System | Debug | InternalComment | Warning}]
+ [-TagFilter <String[]>]
+ [-RunspaceFilter <Guid>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Register-DbaMessageEvent -Name 'Mymodule.OffloadTrigger' -ScriptBlock $ScriptBlock -Tag 'engine' -Module 'MyModule' -Level Warning
+
+Registers an event subscription ...
The name of the subscription.
+Each subscription must have a name, subscriptions of equal name will overwrite each other.
+This is in order to avoid having runspace uses explode the number of subscriptions on each invocation.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The scriptblock to execute.
+It will receive the message entry (as returned by Get-DbatoolsLog) as its sole argument.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Filter by message content. Understands wildcards, but not regex.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Filter by Name of the module, from which the message comes. Understands wildcards, but not regex.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Filter by Name of the function, from which the message comes. Understands wildcards, but not regex.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Filter by target object. Performs equality comparison on an object level.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Include only messages of the specified levels.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Only include messages with any of the specified tags.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Only include messages which were written by the specified runspace.
+You can find out the current runspace ID by running this:
+[System.Management.Automation.Runspaces.Runspace]::DefaultRunspace.InstanceId
+You can retrieve the primary runspace - the Guid used by the runspace the user sees - by running this:
+[Sqlcollaborative.Dbatools.Utility.UtilityHost]::PrimaryRunspace
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Register-DbaMessageEvent on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Register-DbaMessageEvent.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Registers a scriptblock that can transform message content.
+Registers a scriptblock that can transform message content. +This can be used to convert some kinds of input. Specifically:
+Target: +When specifying a target, this target may require some conversion. +For example, an object containing a live connection may need to have a static copy stored instead, +as otherwise its export on a different runspace may cause access violations.
+Exceptions: +Some exceptions may need transforming. +For example some APIs might wrap the actual exception into a common wrapper. +In this scenario you may want the actual exception in order to provide more specific information.
+In all instances, the scriptblock will be called, receiving only the relevant object as its sole input.
+Note: This transformation is performed synchronously on the active runspace. Complex scriptblocks may delay execution times when a matching object is passed.
+Register-DbaMessageTransform -TargetType <String> -ScriptBlock <ScriptBlock>
+ [<CommonParameters>]
+
+Register-DbaMessageTransform -ExceptionType <String> -ScriptBlock <ScriptBlock>
+ [<CommonParameters>]
+
+Register-DbaMessageTransform -ScriptBlock <ScriptBlock> -TargetTypeFilter <String>
+ [-FunctionNameFilter <Object>]
+ [-ModuleNameFilter <Object>]
+ [<CommonParameters>]
+
+Register-DbaMessageTransform -ScriptBlock <ScriptBlock> -ExceptionTypeFilter <String>
+ [-FunctionNameFilter <Object>]
+ [-ModuleNameFilter <Object>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Register-DbaMessageTransform -TargetType 'mymodule.category.classname' -ScriptBlock $ScriptBlock
+
+Whenever a target object of type 'mymodule.category.classname' is specified, invoke $ScriptBlock (with the object as sole argument) and store the result as target instead.
PS C:\> Register-DbaMessageTransform -ExceptionType 'mymodule.category.exceptionname' -ScriptBlock $ScriptBlock
+
+Whenever an exception or error record of type 'mymodule.category.classname' is specified, invoke $ScriptBlock (with the object as sole argument) and store the result as exception instead.
+If the full error record is specified, only the updated exception will be inserted
PS C:\> Register-DbaMessageTransform -TargetTypeFilter 'mymodule.category.*' -ScriptBlock $ScriptBlock
+
+Adds a transform for all target objects that are of a type whose full name starts with 'mymodule.category.'
+All target objects matching that typename will be run through the specified scriptblock, which in return generates the new target object.
The full typename of the target object to apply the scriptblock to.
+All objects of that typename will be processed through that scriptblock.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The full typename of the exception object to apply the scriptblock to.
+All objects of that typename will be processed through that scriptblock.
+Note: In case of error records, the type of the Exception Property is inspected. The error record as a whole will not be touched, except for having its exception exchanged.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The scriptblock that performs the transformation.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
A filter for the typename of the target object to transform.
+Supports wildcards, but not regex.
+WARNING: Adding too many filter-type transforms may impact overall performance, try to avoid using them!
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
A filter for the typename of the exception object to transform.
+Supports wildcards, but not regex.
+WARNING: Adding too many filter-type transforms may impact overall performance, try to avoid using them!
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Default: "*"
+Allows filtering by function name, in order to consider whether the function is affected.
+Supports wildcards, but not regex.
+WARNING: Adding too many filter-type transforms may impact overall performance, try to avoid using them!
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +* | +
Default: "*"
+Allows filtering by module name, in order to consider whether the function is affected.
+Supports wildcards, but not regex.
+WARNING: Adding too many filter-type transforms may impact overall performance, try to avoid using them!
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +* | +
+
Want to see the source code for this command? Check out Register-DbaMessageTransform on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Register-DbaMessageTransform.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Registers a scriptblock to run in the background.
+This function registers a scriptblock to run in separate runspace. +This is different from most runspace solutions, in that it is designed for permanent background tasks that need to be done. +It guarantees a single copy of the task to run within the powershell process, even when running the same module in many runspaces in parallel.
+Updating: +If this function is called multiple times, targeting the same name, it will update the scriptblock.
+Register-DbaRunspace -ScriptBlock <ScriptBlock> -Name <String>
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Register-DbaRunspace -ScriptBlock $scriptBlock -Name 'mymodule.maintenance'
+
+Registers the script defined in $scriptBlock under the name 'mymodule.maintenance'
+It does not start the runspace yet. If it already exists, it will overwrite the scriptblock without affecting the running script.
PS C:\> Register-DbaRunspace -ScriptBlock $scriptBlock -Name 'mymodule.maintenance'
+PS C:\> Start-DbaRunspace -Name 'mymodule.maintenance'
+
+Registers the script defined in $scriptBlock under the name 'mymodule.maintenance'
+Then it starts the runspace, running the registered $scriptBlock
The scriptblock to run in a dedicated runspace
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The name to register the scriptblock under.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
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 | +
+
Want to see the source code for this command? Check out Register-DbaRunspace on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Register-DbaRunspace.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Registers a parameter for a prestored Tepp.
+Registers a parameter for a prestored Tepp. +This function allows easily registering a function's parameter for Tepp in the function-file, rather than in a centralized location.
+Register-DbaTeppArgumentCompleter
+ [[-Command] <String[]>]
+ [[-Parameter] <String[]>]
+ [[-Name] <String>]
+ [-All]
+ [<CommonParameters>]
+
+
++
+
PS > Register-DbaTeppArgumentCompleter -Command Get-DbaDbBackupHistory -Parameter Database
+Registers the "Database" parameter of the Get-DbaDbBackupHistory to receive Database-Tepp
Name of the command whose parameter should receive Tepp.
+Supports multiple commands at the same time in order to optimize performance.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Name of the parameter that should be Tepp'ed.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Name of the Tepp Completioner to use.
+Defaults to the parameter name.
+Best practice requires a Completioner to be named the same as the completed parameter, in which case this parameter needs not be specified.
+However sometimes that may not be universally possible, which is when this parameter comes in.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Whether this TEPP applies to all commands in dbatools that have the specified parameter.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Register-DbaTeppArgumentCompleter on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Register-DbaTeppArgumentCompleter.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Registers a scriptblock used to build the TEPP cache from an instance connection.
+Registers a scriptblock used to build the TEPP cache from an instance connection. +Used only on import of the module.
+Register-DbaTeppInstanceCacheBuilder
+ [-ScriptBlock] <ScriptBlock>
+ [-Slow]
+ [<CommonParameters>]
+
+
++
+
PS > Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock
+Registers the scriptblock stored in the aptly named variable $ScriptBlock as a fest cache building scriptblock.
+Note: The scriptblock must execute swiftly! (less than 25ms)
PS > Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -Slow
+Registers the scriptblock stored in the aptly named variable $ScriptBlock as a slow cache building scriptblock.
+This is suitable for cache building scriptblocks that take a while to execute.
The ScriptBlock used to build the cache. +The ScriptBlock may assume the following two variables to exist:
++ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
This switch implies a gathering process that takes too much time to be performed synchronously.
+Basically, when retrieving the information takes more than 25ms on an average server (on top of establishing the original connection), this switch should be set.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Register-DbaTeppInstanceCacheBuilder on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Register-DbaTeppInstanceCacheBuilder.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Registers a scriptblock under name, to later be available for TabExpansion.
+Registers a scriptblock under name, to later be available for TabExpansion.
+Register-DbaTeppScriptblock
+ [[-ScriptBlock] <ScriptBlock>]
+ [[-Name] <String>]
+ [<CommonParameters>]
+
+
++
+
PS > Register-DbaTeppScriptblock -ScriptBlock $scriptBlock -Name MyFirstTeppScriptBlock
+Stores the scriptblock stored in $scriptBlock under the name "MyFirstTeppScriptBlock"
The scriptblock to register.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The name under which the scriptblock should be registered.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Register-DbaTeppScriptblock on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Register-DbaTeppScriptblock.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Registers a validation scriptblock for use with the configuration system.
+Registers a validation scriptblock for use with the configuration system.
+The scriptblock must be designed according to a few guidelines:
+Register-DbatoolsConfigValidation
+ [-Name] <String>
+ [-ScriptBlock] <ScriptBlock>
+ [<CommonParameters>]
+
+
++
+
PS C:\> Register-DbatoolsConfigValidation -Name IntPositive -ScriptBlock $scriptBlock
+
+Registers the scriptblock stored in $scriptBlock as validation with the name IntPositive
The name under which to register the validation scriptblock
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The scriptblock to register
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Register-DbatoolsConfigValidation on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Register-DbatoolsConfigValidation.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Registers a PSSessionConfiguration on a remote machine
+Registers a session with a custom credentials on a remote machine through WinRM. +Designed to overcome the double-hop issue and as an alternative to CredSSP protocol.
+Register-RemoteSessionConfiguration
+ [-ComputerName] <Object>
+ [[-Name] <String>]
+ [-Credential] <PSCredential>
+ [[-RunAsCredential] <PSCredential>]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +dbatools_remotesession | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +$Credential | +
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Register-RemoteSessionConfiguration on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Register-RemoteSessionConfiguration.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Removes a message level modifier.
+Removes a message level modifier.
+Message Level Modifiers can be created by using New-DbaMessageLevelModifier. +They are used to emphasize or deemphasize messages, in order to help with debugging.
+Remove-DbaMessageLevelModifier
+ [[-Name] <String[]>]
+ [[-Modifier] <MessageLevelModifier[]>]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Get-DbaMessageLevelModifier | Remove-DbaMessageLevelModifier
+
+Removes all message level modifiers, restoring everything to their default levels.
PS C:\> Remove-DbaMessageLevelModifier -Name "mymodule.foo"
+
+Removes the message level modifier named "mymodule.foo"
Name of the message level modifier to remove.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
The actual modifier to remove, as returned by Get-DbaMessageLevelModifier.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
This parameters disables user-friendly warnings and enables the throwing of exceptions.
+This is less user friendly, but allows catching exceptions in calling scripts.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Remove-DbaMessageLevelModifier on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Remove-DbaMessageLevelModifier.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Remove-InvalidFileNameChars -Name
Remove-InvalidFileNameChars[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Remove-InvalidFileNameChars; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue, ByPropertyName) | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Remove-InvalidFileNameChars on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Remove-InvalidFileNameChars.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function to remove an item from the TEPP cache.
+Internal function to remove an item from the TEPP cache.
+Remove-TeppCacheItem
+ [-SqlInstance] <DbaInstanceParameter>
+ [-Type] <String>
+ [-Name] <String>
+ [<CommonParameters>]
+
+
++
+
PS > Remove-TeppCacheItem -SqlInstance $server -Type database -Name AdventureWorks
+Removes the entry for the database AdventureWorks from the TEPP cache.
The SQL Server instance.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The type of object. Must be part of "[Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache.Keys".
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The name of the object that should be removed from the cache.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Remove-TeppCacheItem on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Remove-TeppCacheItem.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Resolves the computer based on the ComputerName of the input DbaInstanceParameter.
+Resolves the computer based on the ComputerName of the input DbaInstanceParameter. +Designed to get the FullComputerName needed for Invoke-Command2. +Default is to return the FullComputerName, but can also return other properties returned by Resolve-DbaNetworkName. +But if ComputerName is the local host, always returns the property ComputerName.
+Resolve-DbaComputerName
+ [-ComputerName] <DbaInstanceParameter>
+ [[-Credential] <PSCredential>]
+ [[-Property] <String>]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +FullComputerName | +
Accepted Values | +ComputerName,IPAddress,DNSHostname,DNSDomain,Domain,DNSHostEntry,FQDN,FullComputerName | +
+
Want to see the source code for this command? Check out Resolve-DbaComputerName on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Resolve-DbaComputerName.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Resolve-IpAddress -Server
Resolve-IpAddress[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Resolve-IpAddress; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | +ServerInstance,SqlInstance,ComputerName,SqlServer | +
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Resolve-IpAddress on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Resolve-IpAddress.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Resolve-SqlIpAddress -SqlInstance
Resolve-SqlIpAddress[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Resolve-SqlIpAddress; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Resolve-SqlIpAddress on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Resolve-SqlIpAddress.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Restarts WinRM service on a remote machine and waits for it to get back up
+Restarts WinRM service on a remote machine and waits for it to get back up by attempting to establish a WinRM session.
+Restart-WinRMService
+ [-ComputerName] <Object>
+ [[-Credential] <PSCredential>]
+ [[-Timeout] <Int32>]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +30 | +
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Restart-WinRMService on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Restart-WinRMService.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Select-DefaultView [-InputObject
Select-DefaultView[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Select-DefaultView; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+ | + |
---|---|
Alias | +Properties | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Select-DefaultView on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Select-DefaultView.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
This function sends a file (or folder of files recursively) to a destination WinRm session. This function was originally +built by Lee Holmes (http://poshcode.org/2216) but has been modified to recursively send folders of files as well +as to support UNC paths.
+Author: Adam Bertram +From: https://gallery.technet.microsoft.com/scriptcenter/Send-Files-or-Folders-over-273971bf
+Send-File
+ [-Path] <String[]>
+ [-Destination] <String>
+ [-Session] <PSSession>
+ [<CommonParameters>]
+
+
++
+
PS > $session = New-PSSession -ComputerName MYSERVER
+Send-File -Path C:\test.txt -Destination C:\ -Session $session
+This example will copy the file C:\test.txt to be C:\test.txt on the computer MYSERVER
The local or UNC folder path that you'd like to copy to the session. This also support multiple paths in a comma-delimited format.
+If this is a UNC path, it will be copied locally to accomodate copying. If it's a folder, it will recursively copy
+all files and folders to the destination.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The local path on the remote computer where you'd like to copy the folder or file. If the folder does not exist on the remote
+computer it will be created.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The remote session. Create with New-PSSession.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Send-File on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Send-File.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Set-FileSystemSetting [-Instance
Set-FileSystemSetting[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Set-FileSystemSetting; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Set-FileSystemSetting on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Set-FileSystemSetting.
+ | + |
---|---|
Author | +Kirill Kravtsov ( @nvarscar ) | +
Availability | +Windows, Linux, macOS | +
+
Internal function. Implements the method that changes startup mode of the SQL Server service.
+Accepts objects from Get-DbaService and performs a corresponding action.
+Set-ServiceStartMode
+ [[-Mode] <String>]
+ [-InputObject] <Object[]>
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
PS > Get-DbaService -ComputerName sql1 | Set-ServiceStartMode -Mode 'Manual'
+Sets all SQL services on sql1 to Manual startup.
PS > $services = Get-DbaService -ComputerName sql1
+Set-ServiceStartMode -InputObject $services -Mode 'Automatic'
+Sets all SQL services on sql1 to Automatic startup.
A collection of services from Get-DbaService.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
Startup mode of the service: Automatic, Manual or Disabled.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Prompts you for confirmation before running the cmdlet.
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Set-ServiceStartMode on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Set-ServiceStartMode.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Show-Notification [-GalleryVersion
Show-Notification[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Show-Notification; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Show-Notification on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Show-Notification.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Starts a managed runspace
+Starts a runspace that was registered to dbatools +Simply registering does not automatically start a given runspace. Only by executing this function will it take effect.
+Start-DbaRunspace
+ [[-Name] <String[]>]
+ [[-Runspace] <RunspaceContainer[]>]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Start-DbaRunspace -Name 'mymodule.maintenance'
+
+Starts the runspace registered under the name 'mymodule.maintenance'
The name of the registered runspace to launch
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
The runspace to launch. Returned by Get-DbaRunspace
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
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 | +
+
Want to see the source code for this command? Check out Start-DbaRunspace on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Start-DbaRunspace.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Start-DbccCheck [-server
Start-DbccCheck[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Start-DbccCheck; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Start-DbccCheck on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Start-DbccCheck.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Stops a managed runspace
+Stops a runspace that was registered to dbatools. +Will not cause errors if the runspace is already halted.
+Runspaces may not automatically terminate immediately when calling this function. +Depending on the implementation of the scriptblock, this may in fact take a little time. +If the scriptblock hasn't finished and terminated the runspace in a seemingly time, it will be killed by the system. +This timeout is by default 30 seconds, but can be altered by using the Configuration System. +For example, this line will increase the timeout to 60 seconds: +Set-DbatoolsConfig Runspace.StopTimeout 60
+Stop-DbaRunspace
+ [[-Name] <String[]>]
+ [[-Runspace] <RunspaceContainer[]>]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Stop-DbaRunspace -Name 'mymodule.maintenance'
+
+Stops the runspace registered under the name 'mymodule.maintenance'
The name of the registered runspace to stop
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
The runspace to stop. Returned by Get-DbaRunspace
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
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 | +
+
Want to see the source code for this command? Check out Stop-DbaRunspace on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Stop-DbaRunspace.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Function that interrupts a function.
+Function that interrupts a function.
+This function is a utility function used by other functions to reduce error catching overhead. +It is designed to allow gracefully terminating a function with a warning by default and also allow opt-in into terminating errors. +It also allows simple integration into loops.
+Note: +When calling this function with the intent to terminate the calling function in non-EnableException mode too, you need to add a return below the call.
+Stop-Function -Message <String>
+ [-EnableException <Boolean>]
+ [-Category {NotSpecified | OpenError | CloseError | DeviceError | DeadlockDetected | InvalidArgument | InvalidData | InvalidOperation | InvalidResult | InvalidType | MetadataError | NotImplemented | NotInstalled | ObjectNotFound | OperationStopped | OperationTimeout | SyntaxError | ParserError | PermissionDenied | ResourceBusy | ResourceExists | ResourceUnavailable | ReadError | WriteError | FromStdErr | SecurityError | ProtocolError | ConnectionError | AuthenticationError | LimitsExceeded | QuotaExceeded | NotEnabled}]
+ [-Tag <String[]>]
+ [-FunctionName <String>]
+ [-File <String>]
+ [-Line <Int32>]
+ [-Target <Object>]
+ [-Exception <Exception>]
+ [-OverrideExceptionMessage]
+ [-Continue]
+ [-SilentlyContinue]
+ [-ContinueLabel <String>]
+ [<CommonParameters>]
+
+Stop-Function -Message <String>
+ [-EnableException <Boolean>]
+ [-Category {NotSpecified | OpenError | CloseError | DeviceError | DeadlockDetected | InvalidArgument | InvalidData | InvalidOperation | InvalidResult | InvalidType | MetadataError | NotImplemented | NotInstalled | ObjectNotFound | OperationStopped | OperationTimeout | SyntaxError | ParserError | PermissionDenied | ResourceBusy | ResourceExists | ResourceUnavailable | ReadError | WriteError | FromStdErr | SecurityError | ProtocolError | ConnectionError | AuthenticationError | LimitsExceeded | QuotaExceeded | NotEnabled}]
+ [-ErrorRecord <ErrorRecord[]>]
+ [-Tag <String[]>]
+ [-FunctionName <String>]
+ [-File <String>]
+ [-Line <Int32>]
+ [-Target <Object>]
+ [-Exception <Exception>]
+ [-OverrideExceptionMessage]
+ [-Continue]
+ [-SilentlyContinue]
+ [-ContinueLabel <String>]
+ [<CommonParameters>]
+
+
++
+
PS > Stop-Function -Message "Foo failed bar." -EnableException $EnableException -ErrorRecord $_
+return
+Depending on whether $EnableException is true or false it will:
PS > Stop-Function -Message "Foo failed bar." -EnableException $EnableException -Category InvalidOperation -Target $foo -Continue
+Depending on whether $silent is true or false it will:
A message to pass along, explaining just what the error was.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
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 | +$EnableException | +
What category does this termination belong to?
+Mandatory so long as no inner exception is passed.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +NotSpecified | +
An option to include an inner exception in the error record (and in the exception thrown, if one is thrown).
+Use this, whenever you call Stop-Function in a catch block.
+Note:
+Pass the full error record, not just the exception.
+ | + |
---|---|
Alias | +InnerErrorRecord | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Tags to add to the message written.
+This allows filtering and grouping by category of message, targeting specific messages.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The name of the function to crash.
+This parameter is very optional, since it automatically selects the name of the calling function.
+The function name is used as part of the errorid.
+That in turn allows easily figuring out, which exception belonged to which function when checking out the $error variable.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +((Get-PSCallStack)[0].Command) | +
The file in which Stop-Function was called.
+Will be automatically set, but can be overridden when necessary.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The line on which Stop-Function was called.
+Will be automatically set, but can be overridden when necessary.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
The object that was processed when the error was thrown.
+For example, if you were trying to process a Database Server object when the processing failed, add the object here.
+This object will be in the error record (which will be written, even in non-EnableException mode, just won't show it).
+If you specify such an object, it becomes simple to actually figure out, just where things failed at.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Allows specifying an inner exception as input object. This will be passed on to the logging and used for messages.
+When specifying both ErrorRecord AND Exception, Exception wins, but ErrorRecord is still used for record metadata.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Disables automatic appending of exception messages.
+Use in cases where you already have a speaking message interpretation and do not need the original message.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
This will cause the function to call continue while not running silently.
+Useful when mass-processing items where an error shouldn't break the loop.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
This will cause the function to call continue while running silently.
+Useful when mass-processing items where an error shouldn't break the loop.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
When specifying a label in combination with "-Continue" or "-SilentlyContinue", this function will call continue with this specified label.
+Helpful when trying to continue on an upper level named loop.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Stop-Function on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Stop-Function.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Helper function that tests if a parameter was bound.
+Helper function that tests if one or more parameters was bound.
+Test-Bound
+ [[-ParameterName] <String[]>]
+ [-Not]
+ [-And]
+ [[-Min] <Int32>]
+ [[-Max] <Int32>]
+ [[-BoundParameters] <Object>]
+ [<CommonParameters>]
+
+
++
+
PS > if (Test-Bound "Day")
+{
+}
+Snippet as part of a function. Will check whether the parameter "Day" was bound. If yes, whatever logic is in the conditional will be executed.
PS > Test-Bound -Not 'Login', 'Spid', 'ExcludeSpid', 'Host', 'Program', 'Database'
+Returns whether none of the parameters above were specified.
PS > Test-Bound -And 'Login', 'Spid', 'ExcludeSpid', 'Host', 'Program', 'Database'
+Returns whether any of the specified parameters was not bound.
PS > Test-Bound -ParameterName 'MinimumBuild', 'MaxBehind', 'Latest' -Max 1
+Tests for mutually exclusive but necessary parameters.
PS > Test-Bound -ParameterName 'Database', 'AllDatabases', 'ExcludeDatabase' -Min 0 -Max 1
+Tests for mutually exclusive but optional parameters.
+Do not be tempted to use [CmdletBinding()] here, this will subtly change the way this function's parameters are bound, and break it.
The name(s) of the parameter that is tested for being bound.
+By default, the check is true when AT LEAST one was bound.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Reverses the result. Returns true if NOT bound and false if bound.
+ | + |
---|---|
Alias | +Reverse | +
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
All specified parameters must be present, rather than at least one of them.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
At least the specified number of parameters out of the specified parameters must be present. Default is 1.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +1 | +
A maximum of the specified number of parameters out of the specified parameters may be present. Default is the length of ParameterName.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +$ParameterName.Length | +
The hashtable of bound parameters. Is automatically inherited from the calling function via default value. Needs not be bound explicitly.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +$($ExecutionContext.SessionState.PSVariable.Get('psboundparameters').Value) | +
+
Want to see the source code for this command? Check out Test-Bound on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-Bound.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Validates whether the input string can be legally used to target a computer.
+Validates whether the input string can be legally used to target a computer. +It will consider:
+Test-ComputerTarget
+ [-ComputerName] <String[]>
+ [<CommonParameters>]
+
+
++
+
PS C:\> Test-ComputerTarget -ComputerName 'server1'
+
+Will test whether 'server1' is a legal computername (hint: it is)
PS C:\> "foo", "bar", "foo bar" | Test-ComputerTarget
+
+Will test, whether the names passed to it are legal targets.
The name to verify
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Test-ComputerTarget on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-ComputerTarget.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Tests whether a function or one of its parameters was called by a bad name.
+Tests whether a function or one of its parameters was called by a bad name. +This allows giving deprecation warnings - once per session - whenever a user uses something we are planning on removing.
+For example, when renaming a function, we give a grace period by adding an Alias for that function with its old name. +However, we do not want to carry along this alias forever, so we give warning ahead of time using this function. +When reaching the specified version, we then can safely remove the alias.
+Furthermore, this function is used for testing, whether such a removal was properly done.
+Test-DbaDeprecation -DeprecatedOn <Version>
+ [-FunctionName <String>]
+ [-Call <Object>] -Parameter <String>
+ [-CustomMessage <String>]
+ [-EnableException <Boolean>]
+ [<CommonParameters>]
+
+Test-DbaDeprecation -DeprecatedOn <Version>
+ [-FunctionName <String>]
+ [-Call <Object>] -Alias <String>
+ [-CustomMessage <String>]
+ [-EnableException <Boolean>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Test-DbaDeprecation -DeprecatedOn "1.0.0.0" -Parameter 'Details'
+
+Will - once per session - complain if the parameter 'Details' is used.
+Will cause tests to fail, if it's still in the code after release 1.0.0.0.
PS C:\> Test-DbaDeprecation -DeprecatedOn "1.0.0.0" -Alias Copy-SqlDatabase
+
+Will - once per session - complain if the alias 'Copy-SqlDatabase' is used.
+Will cause tests to fail, if it's still in the code after release 1.0.0.0.
The version this parameter or alias will be removed in.
+Generally, deprecated parameters and aliases should only be removed on major releases.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The parameter that has become deprecated.
+On renamed parameters, keep a parameter-alias. This function will notice, when the alias is used.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
The alias of the command that will be deprecated.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Automatically filled with the calling function.
+The name of the function that contains either a deprecated alias or parameter.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +(Get-PSCallStack)[0].Command | +
The InvocationInfo of the calling function.
+Automatically filled.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +(Get-PSCallStack)[0].InvocationInfo | +
This function will generate a default message. However, this may not always be appropriate.
+Use CustomMessage to tailor a response to the necessity of the moment.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | +$EnableException | +
+
Want to see the source code for this command? Check out Test-DbaDeprecation on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-DbaDeprecation.
+ | + |
---|---|
Author | +Stuart Moore (@napalmgram), stuart-moore.com | +
Availability | +Windows, Linux, macOS | +
+
Checks that a filtered array from Get-FilteredRestore contains a restorabel chain of LSNs
+Finds the anchoring Full backup (or multiple if it's a striped set). +Then filters to ensure that all the backups are from that anchor point (LastLSN) and that they're all on the same RecoveryForkID +Then checks that we have either enough Diffs and T-log backups to get to where we want to go. And checks that there is no break between +LastLSN and FirstLSN in sequential files
+Test-DbaLsnChain
+ [-FilteredRestoreFiles] <Object[]>
+ [-Continue]
+ [-EnableException]
+ [<CommonParameters>]
+
+
++
+
PS > Test-DbaLsnChain -FilteredRestoreFiles $FilteredFiles
+Checks that the Restore chain in $FilteredFiles is complete and can be fully restored
This is just an object consisting of the output from Read-DbaBackupHeader. Normally this will have been filtered down to a restorable chain
+before arriving here. (ie; only 1 anchoring Full backup)
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Test-DbaLsnChain on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-DbaLsnChain.
+ | + |
---|---|
Author | +Stuart Moore (@napalmgram), stuart-moore.com | +
Availability | +Windows, Linux, macOS | +
+
Checks that the restore files are from a version of SQL Server that can be restored on the target version
+Finds the anchoring Full backup (or multiple if it's a striped set). +Then filters to ensure that all the backups are from that anchor point (LastLSN) and that they're all on the same RecoveryForkID +Then checks that we have either enough Diffs and T-log backups to get to where we want to go. And checks that there is no break between +LastLSN and FirstLSN in sequential files
+Test-DbaRestoreVersion
+ [-SqlInstance] <Object>
+ [-FilteredRestoreFiles] <Object[]>
+ [[-SqlCredential] <PSCredential>]
+ [-SystemDatabaseRestore]
+ [<CommonParameters>]
+
+
++
+
PS > Test-DbaRestoreVersion -FilteredRestoreFiles $FilteredFiles -SqlInstance server1\instance1
+Checks that the Restore chain in $FilteredFiles is compatible with the SQL Server version of server1\instance1
Sql Server Instance against which the restore is going to be performed
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
This is just an object consisting of the output from Read-DbaBackupHeader. Normally this will have been filtered down to a restorable chain
+before arriving here. (ie; only 1 anchoring Full backup)
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Credential for connecting to SqlInstance
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Switch when restoring system databases
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Test-DbaRestoreVersion on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-DbaRestoreVersion.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Command that tests, whether the process runs elevated and has to run as such.
+Command that tests, whether the process runs elevated and has to run as such. +Some commands require to be run elevated, when executed against localhost, but not when run against a remote computer. +This command handles that test and manages the reaction to it.
+Test-ElevationRequirement
+ [-ComputerName <DbaInstanceParameter>]
+ [-Continue]
+ [-ContinueLabel <String>]
+ [-SilentlyContinue]
+ [-EnableException <Boolean>]
+ [<CommonParameters>]
+
+Test-ElevationRequirement
+ [-ComputerName <DbaInstanceParameter>]
+ [-NoStop]
+ [-EnableException <Boolean>]
+ [<CommonParameters>]
+
+
++
+
PS > $null = Test-ElevationRequirement -ComputerName $instance -Continue
+This will test whether the currently processed instance is localhost and the process is running elevated.
+If it should have elevation but is not running with elevation:
PS > if (-not ( Test-ElevationRequirement -ComputerName $instance -NoStop)) {
+# Do whatever
+}
+This will test whether the currently processed instance is localhost and the process is running elevated.
+If it isn't running elevated but should be, the overall condition will be met and the if-block is executed.
The computer that is being targeted by the calling command.
+This must be a localhost variety, for it to be able to fail.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
When using the native capability to terminate on fail, this will call continue in non-EnableException mode.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
When using the native capability to terminate on fail, and using a continue mode, the continue will continue with this label.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
When using the native capability to terminate on fail, this will call continue in EnableException mode.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Does not call stop-function when the test fails, rather only returns $false instead
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
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 | +$EnableException | +
+
Want to see the source code for this command? Check out Test-ElevationRequirement on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-ElevationRequirement.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Test-ExportDirectory [-Path
Test-ExportDirectory[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Test-ExportDirectory; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Test-ExportDirectory on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-ExportDirectory.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal tool, used to gracefully interrupt a function.
+This helper function is designed to work in tandem with Stop-Function. +When gracefully terminating a function, there is a major issue: +"Return" will only stop the current one of the three blocks (Begin, Process, End). +All other statements have side effects or produce lots of red text.
+So, Stop-Function writes a variable into the parent scope, that signals the function should cease. +This function then checks for that very variable and returns true if it is set.
+This avoids having to handle odd variables in the parent function and causes the least impact on contributors.
+Test-FunctionInterrupt
+ [<CommonParameters>]
+
+
++
+
PS > if (Test-FunctionInterrupt)
+The calling function will stop if this function returns true.
+
Want to see the source code for this command? Check out Test-FunctionInterrupt on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-FunctionInterrupt.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Test-HostOSLinux [-SqlInstance
Test-HostOSLinux[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Test-HostOSLinux; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Test-HostOSLinux on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-HostOSLinux.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Test-PSRemoting -ComputerName
Test-PSRemoting[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Test-PSRemoting; CommonParameters=True; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Test-PSRemoting on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-PSRemoting.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Based on https://github.com/adbertram/PSSqlUpdater +This function tests various registry values to see if the local computer is pending a reboot
+Test-PendingReboot
+ [-ComputerName] <DbaInstanceParameter>
+ [[-Credential] <PSCredential>]
+ [-NoPendingRename]
+ [<CommonParameters>]
+
+
++
+
PS>Test-PendingReboot
+This example checks various registry values to see if the local computer is pending a reboot.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Test-PendingReboot on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-PendingReboot.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal tool, used to detect the version of PowerShell
+We still support PS3 and as future continues we will have to maintain code base for PS3 and code base for newer versions of PowerShell. This is just easier function to use for validating version of PS with if/else statements
+Test-PsVersion
+ [[-Is] <Single>]
+ [[-Minimum] <Single>]
+ [[-Maximum] <Single>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> if (Test-PsVersion -Is 3) {
+>> #do something
+>> }
+
+The calling function will only execute code if PS version is 3.0.
PS C:\> if (Test-PsVersion -Minimum 4) {
+>> #do something
+>> }
+
+The calling function will only execute code if PS version is 4.0 or higher.
PS C:\> if (Test-PsVersion -Minimum 3 -Maximum 5.1) {
+>> #do something
+>> }
+
+The calling function will only execute code if PS version is found to be between 3.0 and 5 (could include 5.0 or 5.1).
Use to only allow specific version of PowerShell
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
Use to allow for minimum version
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
Use to allow for maximum version
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +0 | +
+
Want to see the source code for this command? Check out Test-PsVersion on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-PsVersion.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. To use instead of $PSCmdlet.ShouldProcess($x, "Message") as +Test-ShouldProcess -Context $PSCmdlet -Target $x -Action "Message"
+Test-ShouldProcess
+ [[-Context] <Object>]
+ [[-Target] <String>]
+ [[-Action] <String>]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Test-ShouldProcess on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-ShouldProcess.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Checks to see if SQL Server Agent is running on a server.
+Test-SqlAgent
+ [-SqlInstance] <Object>
+ [[-SqlCredential] <PSCredential>]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Test-SqlAgent on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-SqlAgent.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Ensures login has access on SQL Server.
+Test-SqlLoginAccess
+ [-SqlInstance] <Object>
+ [[-SqlCredential] <PSCredential>]
+ [[-Login] <String>]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
[switch]$Detailed - can return if its a login or just has access
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Test-SqlLoginAccess on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-SqlLoginAccess.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Test-SqlQueryComplete [-server
Test-SqlQueryComplete[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Test-SqlQueryComplete; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +SqlInstance,SqlServer | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Test-SqlQueryComplete on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-SqlQueryComplete.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Ensures sysadmin account access on SQL Server.
+Test-SqlSa
+ [-SqlInstance] <Object>
+ [[-SqlCredential] <PSCredential>]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Test-SqlSa on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-SqlSa.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal tool, used to detect non-Windows platforms
+Some things don't work with Windows, this is an easy way to detect
+Test-Windows
+ [-NoWarn]
+ [<CommonParameters>]
+
+
++
+
PS > if (-not (Test-Windows))
+The calling function will stop if this function returns true.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Test-Windows on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Test-Windows.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Unregisters a PSSessionConfiguration on a remote machine
+Unregisters a session previously created with Register-RemoteSessionConfiguration through WinRM.
+Unregister-RemoteSessionConfiguration
+ [-ComputerName] <Object>
+ [-Name] <String>
+ [[-Credential] <PSCredential>]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Unregister-RemoteSessionConfiguration on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Unregister-RemoteSessionConfiguration.
+ | + |
---|---|
Author | +Kirill Kravtsov ( @nvarscar ) | +
Availability | +Windows, Linux, macOS | +
+
Internal function. Sends start/stop request to a SQL Server service and wait for the result.
+Accepts objects from Get-DbaService and performs a corresponding action.
+Update-ServiceStatus
+ [-InputObject] <Object[]>
+ [-Action] <String[]>
+ [[-Timeout] <Int32>]
+ [[-Credential] <PSCredential>]
+ [[-EnableException] <Boolean>]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
PS > $InputObject = Get-DbaService -ComputerName sql1
+Update-ServiceStatus -InputObject $InputObject -Action 'stop' -Timeout 30
+Update-ServiceStatus -InputObject $InputObject -Action 'start' -Timeout 30
+Restarts SQL services on sql1
PS > $InputObject = Get-DbaService -ComputerName sql1
+$credential = Get-Credential
+Update-ServiceStatus -InputObject $InputObject -Action 'stop' -Timeout 0 -Credential $credential
+Stops SQL services on sql1 and waits indefinitely for them to stop. Uses $credential to authorize on the server.
A collection of services from Get-DbaService
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
Start or stop.
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
How long to wait for the start/stop request completion before moving on.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +60 | +
Credential object used to connect to the computer as a different user.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
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 | +
Shows what would happen if the cmdlet runs. The cmdlet is not run.
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Prompts you for confirmation before running the cmdlet.
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Update-ServiceStatus on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Update-ServiceStatus.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Updates specified database dbowner.
+Update-SqlDbOwner
+ [-Source] <Object>
+ [-Destination] <Object>
+ [[-DbName] <String>]
+ [[-SourceSqlCredential] <PSCredential>]
+ [[-DestinationSqlCredential] <PSCredential>]
+ [-EnableException]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Update-SqlDbOwner on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Update-SqlDbOwner.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Updates specified database to read-only or read-write. Necessary because SMO doesn't appear to support NO_WAIT.
+Update-SqlDbReadOnly
+ [-SqlInstance] <Object>
+ [-DbName] <String>
+ [-readonly] <Boolean>
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | +False | +
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Update-SqlDbReadOnly on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Update-SqlDbReadOnly.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Internal function. Updates permission sets, roles, database mappings on server and databases
+Update-SqlPermission
+ [-SourceServer] <Object>
+ [-SourceLogin] <Object>
+ [-DestServer] <Object>
+ [-DestLogin] <Object>
+ [-ObjectLevel]
+ [-EnableException]
+ [-WhatIf]
+ [-Confirm]
+ [<CommonParameters>]
+
+
++
+
Source Server
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Source login
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Destination Server
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Destination Login
+ | + |
---|---|
Alias | ++ |
Required | +True | +
Pipeline | +false | +
Default Value | ++ |
Use Export-DbaUser to update object-level permissions as well
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
Use this switch to disable any kind of verbose messages
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+ | + |
---|---|
Alias | +wi | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +cf | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Update-SqlPermission on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Update-SqlPermission.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Handles config export to file.
+Handles config export to file.
+Write-DbatoolsConfigFile
+ [[-Config] <Config[]>]
+ [[-Path] <String>]
+ [-Replace]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Write-DbatoolsConfigFile -Config $items -Path .\file.json
+
+Exports all settings stored in $items to .\file.json.
+If the file already exists, the new settings will be merged into the existing file.
The configuration items to export.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
The path to export to.
+Needs to point to the specific file to export to.
+Will create the folder structure if needed.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
Completely replaces previous file contents.
+By default, it will integrate settings into one coherent configuration file.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +False | +
+
Want to see the source code for this command? Check out Write-DbatoolsConfigFile on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Write-DbatoolsConfigFile.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Function that recognizes html-style tags to insert color into printed text.
+Function that recognizes html-style tags to insert color into printed text.
+Color tags should be designed to look like this:
+<c="
This allows specifying color within strings and avoids having to piece together colored text in multiple calls to Write-Host. +Only colors that are part of the ConsoleColor enumeration can be used. Bad colors will be ignored in favor of the default color.
+Write-HostColor
+ [[-String] <String[]>]
+ [[-DefaultColor] {Black | DarkBlue | DarkGreen | DarkCyan | DarkRed | DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red | Magenta | Yellow | White}]
+ [<CommonParameters>]
+
+
++
+
Write-HostColor -String 'This is going to be <c="red">bloody red text! And this is <c="green">green stuff for extra color'
+Will print the specified line in multiple colors
$string1 = 'This is going to be <c="red">bloody red text! And this is <c="green">green stuff for extra color'
+$string2 = '<c="red">bloody red text! And this is <c="green">green stuff for extra color'
+$string3 = 'This is going to be <c="red">bloody red text! And this is <c="green">green stuff'
+$string1, $string2, $string3 | Write-HostColor -DefaultColor "Magenta"
+Will print all three lines, respecting the color-codes, but use the color "Magenta" as default color.
PS > $stringLong = @"
+Dear <c="red">Sirs<c="green"> and <c="blue">Madams,
+it has come to our attention that you are not sufficiently <c="darkblue">awesome!
+Kindly improve your <c="yellow">AP (<c="magenta">awesome-ness points) by at least 50% to maintain you membership in Awesome Inc!
+You have <c="green">27 3/4 days time to meet this deadline. <c="darkyellow">After this we will unfortunately be forced to rend you assunder and sacrifice your remains to the devil.
+Best regards,
+<c="red">Luzifer
+"@
+Write-HostColor -String $stringLong
+Will print a long multiline text in its entirety while still respecting the colorcodes
The message to write to host.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +true (ByValue) | +
Default Value | ++ |
Default: (Get-DbatoolsConfigValue -Name "message.infocolor")
+The color to write stuff to host in when no (or bad) color-code was specified.
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +(Get-DbatoolsConfigValue -Name "message.infocolor") | +
+
Want to see the source code for this command? Check out Write-HostColor on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Write-HostColor.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Writes an entry to the import module time debug list
+Writes an entry to the import module time debug list
+Write-ImportTime
+ [[-Text] <String>]
+ [[-Timestamp] <Object>]
+ [<CommonParameters>]
+
+
++
+
PS C:\> Write-ImportTime -Text "Starting SMO Import"
+
+Adds the message "Starting SMO Import" to the debug list
The message to write
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | +([DateTime]::now) | +
+
Want to see the source code for this command? Check out Write-ImportTime on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Write-ImportTime.
+ | + |
---|---|
Availability | +Windows, Linux, macOS | +
+
Write-ProgressHelper [-StepNumber
Write-ProgressHelper[32;1msyntaxItem[0m[32;1m----------[0m{@{name=
+
+Write-ProgressHelper; CommonParameters=False; parameter=System.Object[]}}
+
+
++
+
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | +NoProgress | +
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+ | + |
---|---|
Alias | ++ |
Required | +False | +
Pipeline | +false | +
Default Value | ++ |
+
Want to see the source code for this command? Check out Write-ProgressHelper on GitHub.
+
+Want to see the Bill Of Health for this command? Check out Write-ProgressHelper.