HiI am a SQL Server DBA and have never used Powershell before. I'm trying to detach a database using Powershell, but not getting very far.Have read up a bit and most ppl do it like below. I tried to run this, but getting an error that I'm not finding a solution for, so I'm pretty sure I'm doing something very wrong or possibly not doing something that I need to add to the script. Below is what I'm running and the error I'm getting.Please if anyone has any suggestions, please let me know.PS SQLSERVER:\> [void] [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO")PS SQLSERVER:\> $server = new-object Microsoft.SqlServer.Management.Smo.Server('SERVERNAME')PS SQLSERVER:\> $server.DetachDatabase("databasename")Cannot find an overload for "DetachDatabase" and the argument count: "1".At line:1 char:1+ $server.DetachDatabase("databasename")+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : MethodCountCouldNotFindBestThanks!TDP
↧