【发布时间】:2015-09-28 17:09:14
【问题描述】:
我想将远程设备(运行 Windows IoT 的 Raspberry Pi 2)的日期和时间设置为本地设备的日期时间值。
我创建了一个变量 $dateTime 来保存本地 DateTime。 我将连接远程设备的密码分配给变量 $password。 我创建了一个凭证对象。 我使用 Enter-PSSession 连接到远程设备。 现在我已连接,我尝试使用 Set-Date = $dateTime | 分配远程设备 DateTime外串。
我得到 cannot convertvalue "=" to type "System.TimeSpan" 错误。
$dateTime = Get-Date
$password = ConvertTo-SecureString "mypassword" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ("myremotedevice \Administrator",$password)
Enter-PSSession -ComputerName myremotedevice -Credential $cred
Set-Date = $dateTime | Out-String
一旦我通过 PSSession 连接,$dateTime 变量似乎超出了范围。有没有办法解决这个问题?
【问题讨论】:
标签: powershell raspberry-pi iot windows-10-iot-core