DLM Automation 2.1.3.2175 - PS cmdlet error
DatabaseOperations
Posts: 4 New member
All DLM cmdlets error out run during first run. What needs to be done to make the cmdlet run successfully the first time?
Step 1 -
PS> Register-DlmSerialNumber 111-111-111111-1111
Step 1 -
PS> Register-DlmSerialNumber 111-111-111111-1111
Register-DlmSerialNumber : The term 'Register-DlmSerialNumber' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1
+ Register-DlmSerialNumber 111-111-111111-1111
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Register-DlmSerialNumber:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Step 2 -
Step 2 -
PS> Get-Command -Module DlmAutomation
CommandType Name ModuleName
----------- ---- ----------
Cmdlet Export-DatabaseRelease DlmAutomation
Cmdlet Export-DlmDatabasePackage DlmAutomation
Cmdlet Export-DlmDatabaseRelease DlmAutomation
Cmdlet Export-DlmDatabaseTestResults DlmAutomation
Cmdlet Import-DatabaseRelease DlmAutomation
Cmdlet Import-DlmDatabasePackage DlmAutomation
Cmdlet Import-DlmDatabaseRelease DlmAutomation
Cmdlet Invoke-DlmDatabaseSchemaValidation DlmAutomation
Cmdlet Invoke-DlmDatabaseTests DlmAutomation
Cmdlet New-DatabaseConnection DlmAutomation
Cmdlet New-DatabaseRelease DlmAutomation
Cmdlet New-DlmDatabaseConnection DlmAutomation
Cmdlet New-DlmDatabaseDocumentation DlmAutomation
Cmdlet New-DlmDatabasePackage DlmAutomation
Cmdlet New-DlmDatabaseRelease DlmAutomation
Cmdlet New-DlmManualDatabaseSchemaValidation DlmAutomation
Cmdlet Publish-DlmDatabasePackage DlmAutomation
Cmdlet Register-DlmSerialNumber DlmAutomation
Cmdlet Register-RedgateDlmSerialNumber DlmAutomation
Cmdlet Sync-DlmDatabaseSchema DlmAutomation
Cmdlet Test-DatabaseConnection DlmAutomation
Cmdlet Test-DlmDatabaseConnection DlmAutomation
Cmdlet Unregister-DlmSerialNumber DlmAutomation
Cmdlet Use-DatabaseRelease DlmAutomation
Cmdlet Use-DlmDatabaseRelease DlmAutomation
Step 3 -
PS> Register-DlmSerialNumber 111-111-111111-1111
This runs as expected only after step 2.
Tagged:
Best Answer
-
Alex B Posts: 1,157 Diamond 4Hi @DatabaseOperations,
I'm not sure why it would not be showing the cmdlets when they exist; if you have installed DLM Automation it usually prompts you to restart the computer to make sure that currently running applications or services have access to the new modules so maybe it's something related to that? At any rate, adding the import won't hurt anything and will ensure that they are available if they are not.
For SCA, the existing DLM should continue to work (see the release notes):All existing DLM Automation features and workflows continue to be supported. Existing scripts that use DLM Automation cmdlets will continue to work with the SQL Change Automation module.Kind regards,
Alex
Answers
This page seems to indicate that the Get-Command can automatically import the commands, but doesn't say whether this will occur when you use the -Module parameter so may not be the case.
I suppose one way to check is to use the parameter first to see if the DLMAutomation cmdlets have been imported to the session, then use the Get-Command from your step 2 and then the -List-Imported parameter onceonce more.
Also, the version 2.1.3 of DLM Automation is six months old and you may want to look into updating to SQL Change Automation!
Kind regards,
Alex
Have you visited our Help Center?
To make it work, I added an extra step at the top of my automation code to import the module (Import-Module DlmAutomation).
Please note, with DLM 1.4, I didn't have to do this import step.
I plan on upgrading to SCA soon. Could you confirm that the existing cmdlets from DLM 2.1 will work the same in SCA?