简体   繁体   中英

Exception calling “.ctor” with “2” argument(s): “SetParent failed for Login 'XXX'.”

I am creating use for SQL Server 2012 using below code in PowerShell.

$login = new-object Microsoft.SqlServer.Management.Smo.Login($server, $sqlUser)

But I am getting the following error:

Exception calling ".ctor" with "2" argument(s): "SetParent failed for Login 'XXX'."

I am not getting this error on local database (database on the machine where PowerShell script was executed). If I pass in a remote server name, then I get the error. Any thoughts on this error?

根据这个,你需要设置你的域$server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM