Copy-item cmdlet 没有按预期工作,我不明白为什么。这是我的代码:
$Source = "C:\folder1"
$Destination = "\\172.22.0.115\c$\folder2\"
$Password = ConvertTo-SecureString -AsPlainText -Force -String "MyPassword"
$User = "Domain\Administrator"
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user,$password
Copy-Item $Source -Destination $Destination -Credential $credentials
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
The FileSystem provider supports credentials only on the New-PSDrive cmdlet. Perform
the operation again without specifying credentials.
At C:\Sans titre2.ps1:7 char:1
+ Copy-Item $Source -Destination $Destination -Credential $credentials
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (:) [], PSNotSupportedException
+ FullyQualifiedErrorId : NotSupported
Run Code Online (Sandbox Code Playgroud)
我也试过这个:
Start-BitsTransfer -Source $source -Destination $Destination …Run Code Online (Sandbox Code Playgroud) scripting windows powershell windows-server-2012 windows-server-2012-r2
我有一台装有 Powershell V4.0 的 Windows 2008 R2 服务器
我得到了一个非常简单的脚本 test.ps1,其中包含以下内容:
Write-host "Hello world!"
Run Code Online (Sandbox Code Playgroud)
我从一个 powershell 提示符调用这个脚本,如下所示:
measure-command { powershell.exe -file .\test.ps1 }
Run Code Online (Sandbox Code Playgroud)
如您所见,我获得了极高的价值:
Days : 0
Hours : 0
Minutes : 0
Seconds : 7
Milliseconds : 992
Ticks : 79922815
TotalDays : 9,25032581018519E-05
TotalHours : 0,00222007819444444
TotalMinutes : 0,133204691666667
TotalSeconds : 7,9922815
TotalMilliseconds : 7992,2815
Run Code Online (Sandbox Code Playgroud)
或者
Days : 0
Hours : 0
Minutes : 0
Seconds : 4
Milliseconds : 655
Ticks : 46556579
TotalDays : 5,38849293981481E-05
TotalHours : …Run Code Online (Sandbox Code Playgroud) 如何将副本与多个过滤器值一起使用?
例如,如果我只指定 1 个值来过滤 (*.jpg)
Copy-Item -Path Y:\TEST -Recurse -Filter *.jpg -Destination D:\Users\MS5253\Desktop\Lots
Run Code Online (Sandbox Code Playgroud)
这为我创建了一个仅包含 jpg 文件的文件夹 (D:\Users\MS5253\Desktop\Lots\TEST)
但我也想过滤 xml 文件,我试过这个:
Copy-Item -Path Y:\TEST -Recurse -Filter *.jpg,*.xml -Destination D:\Users\MS5253\Desktop\Lots
Run Code Online (Sandbox Code Playgroud)
它给了我一个错误。
和这个 : Copy-Item -Path Y:\TEST -Recurse -include "*.jpg","*.xml" -Destination D:\Users\MS5253\Desktop\Lots
它不起作用...
感谢您的帮助,我正在使用带有 Powershell v4 的 Windows 7。
我有一个托管的 Exchange 2013 服务器,在 Thunderbird 的 POP 中配置了 2 个电子邮件地址。
但是我的电子邮件在雷鸟中阅读后在 OWA 中消失了。
为什么?