Get remote PC's date time?

chrome remote desktop
teamviewer
remote pc access
remote pc download
remote pc login
remote desktop connection
remote access software
microsoft remote desktop

Is there any class available to get a remote PC's date time in .net? In order to do it, I can use a computer name or time zone. For each case, are there different ways to get the current date time? I am using Visual Studio 2005.

I give you a solution which uses WMI. You may or may not need the domain and security information:

try
{
    string pc = "pcname";
    //string domain = "yourdomain";
    //ConnectionOptions connection = new ConnectionOptions();
    //connection.Username = some username;
    //connection.Password = somepassword;
    //connection.Authority = "ntlmdomain:" + domain;

    string wmipath = string.Format("\\\\{0}\\root\\CIMV2", pc);
    //ManagementScope scope = new ManagementScope(
    //    string.Format("\\\\{0}\\root\\CIMV2", pc), connection);
    ManagementScope scope = new ManagementScope(wmipath);
    scope.Connect();

    ObjectQuery query = new ObjectQuery(
        "SELECT * FROM Win32_LocalTime");

    ManagementObjectSearcher searcher =
        new ManagementObjectSearcher(scope, query);

    foreach (ManagementObject queryObj in searcher.Get())
    {
        Console.WriteLine("-----------------------------------");
        Console.WriteLine("Win32_LocalTime instance");
        Console.WriteLine("-----------------------------------");

        Console.WriteLine("Date: {0}-{1}-{2}", queryObj["Year"], queryObj["Month"], queryObj["Day"]);
        Console.WriteLine("Time: {0}:{1}:{2}", queryObj["Hour"], queryObj["Minute"], queryObj["Second"]);
    }
}
catch (ManagementException err)
{
    Console.WriteLine("An error occurred while querying for WMI data: " + err.Message);
}
catch (System.UnauthorizedAccessException unauthorizedErr)
{
    Console.WriteLine("Connection error (user name or password might be incorrect): " + unauthorizedErr.Message);
}

Download RemotePC™ apps for Pc, Mac, Linux, iOS and Android, Remote sessions are secure with TLS v 1.2/AES-256 encryption between local and remote computers. All you need is an active Internet connection to connect to your office or home computer, as though you are sitting right in front of it. To get started, download the windows application and sign up for a RemotePC account. Splashtop remote access & support. Over 20 million users. Fast and secure. Try it free!

On a Windows machine there is net time \\<remote-ip address> to get the time of a remote machine. You could use that to find the remote system time, if you want code you can wrap it up in the function to execute the shell (DOS) functions in C#.

Getting Started, Login to RemotePC and access your PC and Mac from anywhere. Solve Issues Seamlessly & Securely With Rescue Remote Support Software Across Devices. Everything You Need To Provide Powerful Remote Support and Deliver Fast Results, 24/7.

You can use remote WMI and the Win32_TimeZone class. You do need to have permission to execute WMI queries on that machine. Avoid hassle like this by working with UTC instead of local time.

Login to your RemotePC account, Compliance � Support � FAQs � Blog � My Account � Create an Account � Login. Affordable, Comprehensive & Secure Remote Admin Software, Access From Anywhere

Since WMI code would be very slow, you can use the below code to get faster results

            string machineName = "vista-pc";

            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.FileName = "net";
            proc.StartInfo.Arguments = @"time \\" + machineName;
            proc.Start();
            proc.WaitForExit();

            List<string> results = new List<string>();
            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);

                Console.WriteLine(DateTime.Parse(currentTime));
                Console.ReadLine();
            }

Frequently Asked Questions - RemotePC™, RemotePC enables you to connect to your distant Linux computers instantly, over� TheAnswerHub is a top destination for finding answers online. Browse our content today! Find free remote computer on TheAnswerHub.com.

RemotePC™- Features like File transfer, Mobile access, and more., Try TeamViewer for free at home, and distance won't get in the way of you supporting those that you care about. You might even find, that the software would be a� Effective Communication - Communicate efficiently with the associate working on the remote computer through the 'Chat' feature, by sketching out ideas on the 'Whiteboard', or by making notes on the remote screen with 'Sticky Notes'. Remote Recording and Printing - Record remote sessions and save the video file on your local computer for later

Free Remote PC Software: Connect Anywhere, For Remote Access and Support. Control, manage, monitor and repair computers , mobile devices, network machines and more – from anywhere, anytime. Get it� Download this app from Microsoft Store for Windows 10 Mobile, Windows Phone 8.1, Windows Phone 8. See screenshots, read the latest customer reviews, and compare ratings for PC Remote.

TeamViewer: The Remote Desktop Software, Set up the PC you want to connect to so it allows remote connections: For info on how to get it, go to Upgrade Windows 10 Home to Windows� Download this app from Microsoft Store for Windows 10, Windows 8.1, Windows 10 Mobile, Windows Phone 8.1, Windows 10 Team (Surface Hub), HoloLens. See screenshots, read the latest customer reviews, and compare ratings for Microsoft Remote Desktop.

Comments
  • How is the remote PC connected to your machine? Through a network? Through the web?
  • The connect is through network. I can ping to the box by machine name or ip.
  • Actually, I had SQL query to get remote time (SELECT GetDateTime()) from remote PC before I update data back and also wanted to show the remote date time to user. The query was called every 2 minutes and I got some exceptions (may be caused by threading from timer on the form). That's why I am thinking to use any other alternative way to get remote date time.
  • possible duplicate of Get the exact time for a remote server