Jangan lupa untuk menambahkan library :
using System.Diagnostics;
try
{
string machineName = "192.168.0.100";
System.Diagnostics.Process proc = new Process();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.FileName = "net";
proc.StartInfo.Arguments = @"time \\" + machineName;
proc.Start();
proc.WaitForExit();
List
while (!proc.StandardOutput.EndOfStream)
{
string currentline = proc.StandardOutput.ReadLine();
if (!string.IsNullOrEmpty(currentline))
{
results.Add(currentline);
}
}
string currentTime = string.Empty;
if (results.Count > 0 && results[0].ToLower().StartsWith(@"current time at \\" + machineName.ToLower() + " is "))
{
currentTime = results[0].Substring((@"current time at \\" +
machineName.ToLower() + " is ").Length);
MessageBox.Show((DateTime.Parse(currentTime).ToLongTimeString()));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Thank you to:
http://stackoverflow.com/questions/6323613/time-of-another-machine
Good Luck..


Thank you to you, gan.. di tunggu update berikutnya
BalasHapusThank you to you, gan.. di tunggu update berikutnya
BalasHapus