I'm trying to give my SQL server administrators the ability to detach and attach a database through a powershell script. Since they do the backups on the SQL server I want them to be able to run a local script that will execute NWAdmin.exe on the remote SharePoint Application server. I'm trying to pass the content database name and the computer name as parameters.I execute the script and get an error:
PS C:\> .\Scripts\DetachNintexContentDB.ps1 -contentDatabase 'wf_content_sales' -computername entkcspappdt1.xxxx.com'
Command line execution error: System.NullReferenceException: Object reference not set to an instance of an object.
I've replaced the parameter variable in the script with the actual database name and get the same error. Is there a particular reason the command cannot find the database when being executed remotely with Invoke-command?