阅读以下链接后,我能够解决我自己的问题 - 但有谁知道为什么在使用 invoke-sqlcmd 后需要文件系统提供程序,
即。为什么以下失败
$Doc_Folder = "\\Server.fqdn.com\c$\DocFiles"
$DataSet = Invoke-Sqlcmd -Query $sqlQuery -ServerInstance $instanceName -username $SQLCreds.UserName -Password $pswd
Get-ChildItem $Doc_Folder -recurse
以及为什么以下工作
$Doc_Folder = "Microsoft.PowerShell.Core\FileSystem::\\Server.fqdn.com\c$\DocFiles"
$DataSet = Invoke-Sqlcmd -Query $sqlQuery -ServerInstance $instanceName -username $SQLCreds.UserName -Password $pswd
Get-ChildItem $Doc_Folder -recurse
这是我找到添加文件系统提供程序Microsoft.PowerShell.Core\FileSystem:::
powershell-invoke-sqlcmd-get-childitem-cannot-call-method的解决方案的链接