Hello fellows of Win10 IoT Development!
I want to write a program that sets the time of my Raspberry Pi 3 with Windows 10 IoT so my timestamps will be correct.
I am generating an SSH Connection via Renci.SshNet and codes like those do work perfectly fine:
Renci.SshNet.SshClient client = new SshClient(IP, Username, PW);
client.Connect();
client.RunCommand("TZUTIL /s \"W.Europe Standard Time\"");
client.RunCommand("shutdown /r /t 0");
But it is impossible for me to pass the Set-Date command:
I tried all of the following:
// Manual
client.RunCommand("Set-Date " + ((char)34) + "08.06.2016 14:08:45" + ((char)34));
client.RunCommand("Set-Date \"10/3/2015 2:00PM\"");
// Dynamic
System.DateTime dateTime;
dateTime = System.DateTime.Now.AddHours(2);
String datestr = dateTime.ToString();
client.RunCommand("set-date \"" + datestr + "\"");
There is a guide "How to connect via Shell Commands" and the command
Set-Date "08.06.2016 14:31:00"
works perfectly fine, but the same Code doesn't pass anything in the program...
Im am glad for any help!
Note: Related to How to set system time in Windows 10 IoT?