I'm unable to run Backup-SqlDatabase due to errors. I get the following:
PS C:\Users\Mik> Backup-SqlDatabase
Backup-SqlDatabase : The 'Backup-SqlDatabase' command was found in the module 'SqlServer', but the module could not be
loaded. For more information, run 'Import-Module SqlServer'.
At line:1 char:1
+ Backup-SqlDatabase
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Backup-SqlDatabase:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
I run Import-Module as suggested and get this:
PS C:\Users\Mik> Import-Module SqlServer
Import-Module : The following error occurred while loading the extended type data file: Error in TypeData
"Microsoft.SqlServer.Management.Smo.NamedSmoObject": The member DefaultKeyPropertySet is already present.
Error in TypeData "Microsoft.SqlServer.Management.Smo.NamedSmoObject": The member DefaultDisplayPropertySet is already
present.
Error in TypeData "Microsoft.SqlServer.Management.Smo.NamedSmoObject": The member DefaultDisplayProperty is already
present.
At line:1 char:1
+ Import-Module SqlServer
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
I recently installed SQL Server 2016 alongside 2012, am not sure if this has contributed to the problem as I had not used any of these Powershell commands prior.
SqlServerare you loading (check for multiple parallel module versions, and try to import the module by explicitly loading the intended version)? does the error then still occur?