【问题标题】:Powershell Import-Clixml from a shared network folder using full UNC - The system cannot find the file specified使用完整 UNC 从共享网络文件夹中的 Powershell Import-Clixml - 系统找不到指定的文件
【发布时间】:2021-04-28 00:00:39
【问题描述】:

我正在尝试在 SQL 代理作业中运行 powershell 脚本。我不断收到错误:Import-Clixml:系统找不到指定的文件。在 \Data\Powershell\Collibra\Dev\test.ps1:95 char:21 + ... redential = Import-Clixml -Path Filesystem::\Data\Powershell... + ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Import-Clixml], Cryptographic Exception + 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" }

我已尝试映射新驱动器并设置位置。结果相同。这让我发疯了!

感谢您的帮助。

【问题讨论】:

    标签: powershell ssis


    【解决方案1】:

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

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

    【讨论】:

    • 完美!感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-18
    相关资源
    最近更新 更多