使用完整 UNC 从共享网络文件夹中的 Powershell Import-Clixml - 系统找不到指定的文件

Powershell Import-Clixml from a shared network folder using full UNC - The system cannot find the file specified

我正在尝试 运行 SQL 代理作业中的 powershell 脚本。我不断收到错误消息:Import-Clixml:系统找不到指定的文件。在 \Data\Powershell\Collibra\Dev\test.ps1:95 char:21 + ... redential = Import-Clixml -Path Filesystem::\Data\Powershell... + ~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:未指定:(:) [Import-Clixml],加密异常 + FullyQualifiedErrorId:System.Security.Cryptography.CryptographicException,Microsoft.PowerShell.Commands.ImportClixmlCommand

      $Credential = Import-Clixml -Path 
      Filesystem::\energy\data\apps\BISharedServices\Powershell\Collibra\Dev\credentials.xml
      $username = $Credential.GetNetworkCredential().UserName
      $password = $Credential.GetNetworkCredential().Password
      $credPair = "$($username):$($password)"
      $encodedCredentials =       [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($credPair))
      $H = @{ Authorization = "Basic $encodedCredentials" }

我试过映射一个新驱动器并设置位置。相同的结果。这让我抓狂!

感谢您的帮助。

至少在没有 SSIS 的基本 Powershell 中,开头只有一个斜杠:

Import-Clixml -Path FileSystem::\path\to\file.txt