我正在尝试使用power-shell创建一个ssis目录
我得到一个奇怪的错误。这是我正在运行的代码: 我从msdn
获取了代码 $SQLserver = "BM-ELAD\DRC_BUG_RESTORE"
$Link = "false"
$pass = "123456"
# Load the IntegrationServices Assembly
[Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.IntegrationServices")
# Store the IntegrationServices Assembly namespace to avoid typing it every time
$ISNamespace = "Microsoft.SqlServer.Management.IntegrationServices"
# Create a connection to the server
$sqlConnectionString = "Data Source=$SQLserver;Initial Catalog=master;Integrated Security=SSPI;"
$sqlConnection = New-Object System.Data.SqlClient.SqlConnection $sqlConnectionString
# Create the Integration Services object
$integrationServices = New-Object $ISNamespace".IntegrationServices" $sqlConnection
# Provision a new SSIS Catalog
$catalog = New-Object $ISNamespace".Catalog" ($integrationServices, "SSISDB", "$pass")
$catalog.Create()
这是我得到的错误:
GAC Version Location
--- ------- --------
True v2.0.50727 C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.IntegrationServices\13.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.IntegrationServices.dll
New-Object : The term 'New-Object' 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:13 char:18
+ $sqlConnection = New-Object System.Data.SqlClient.SqlConnection $sqlConnectionSt ...
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-Object:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
有没有人遇到过这个问题?我错过了一个文件吗?
我尝试了此修复程序:failed fix但它无效。 我的powershell版本是4.0
当我手动执行此操作时,它可以正常工作。