Reputation: 4882
I have the following PowerShell script to connect to a remote Sql Server Integration Service:
param (
[string]$Server = "GFDBS0002",
[string]$Instance = "DEFAULT",
[string]$Folder = "<SSIS folder>",
[string]$Project
)
Import-Module sqlps -DisableNameChecking
$p = Get-Item SQLSERVER:\SSIS\$Server\$Instance\Catalogs\SSISDB\Folders\$Folder\Projects\$Project
Executing the script fails with:
"WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'GFDBS0002' failed with the following error: Access Denied. (Undtagelse fra HRESULT: 0x80070005 (E_ACCESSDENIED))"
Any suggestions on what I could do to connect ?
Based on the answer by @ArcSet, the following solution worked:
$secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)
$p = Get-Item SQLSERVER:\SSIS\$Server\$Instance\Catalogs\SSISDB\Folders\$Folder\Projects\$Project -Credential $mycreds
Upvotes: 0
Views: 700
Reputation: 6860
The WMI connection doesn't pass your identity and will need you to sign in with your credentials.
Get-Item -Credential (Get-Credential)
Upvotes: 1