How can we modify or change system time (not date) using windows powershell? I was trying to change system time by below command:-
set-date -adjust "Monday, October 17, 2011 5:35:25 PM"
But it throws error saying Cannot convert value "Monday, October 17, 2011 5:35:25 PM" to type System.TimeSpan.
I googled a lot but can't find a way to set the SystemTime using powerShell to a given time. I am baically trying to develop a script that accepts time in hours, minutes, seconds ( like "5:35:25 PM") and then sets the system time to "5:35:25 PM" some thing like below.
function Set-Time( [DateTime]$Time) { set-date -adjust $Time } Set-Time "Monday, October 17, 2011 5:35:25 PM"