如何修改我的脚本以在https上搜索文件?
$source = "https://mysite/searchfolder"
$destination = "\\Transfer"
$searchFiles = Import-CSV 'C:\Users\user1\Desktop\test2.csv' -Header ("filename")
ForEach($File in $searchFiles)
{
Get-ChildItem -Path $source | Where-Object { $_.Name -match $File.filename } | Copy-Item -Destination $destination
}
此脚本提供错误
Get-ChildItem : Cannot find drive. A drive with the name 'https' does not exist.
我一直在读,我可能需要使用Invoke-WebRequest
,但我不确定如何将其构建到我的脚本中。任何指针都会受到赞赏。
答案 0 :(得分:1)
如果您的服务器未将服务公开给列表目录,则无法在https上搜索文件。您将找不到该cmdlet,也无法使用其他编程语言。