在远程服务器上设置系统日期 [英] Set system date on remote server

查看:119
本文介绍了在远程服务器上设置系统日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在远程服务器上是否有API可用于设置系统日期?我只想更改系统日期而不更改远程服务器上的系统时间.请给我建议或指向API资源.请没有命令行.非常感谢.

Is there API available for set system date on remote server? I just want to change system date without changing system time on remote server. Please advise or point me to API resource. No command line please. Greatly appreciated.

最好的问候,

安迪·范

最好的问候,安迪·法姆(Andy Pham)

Best Regards, Andy Pham

推荐答案

日期和时间是一个相同的值.如果不同时设置时间,则无法设置日期.但这不是问题,因为您可以先获取日期/时间,更改日期/时间部分,然后将其保存回去.

Date and time are one and the same value. You cannot set the date without also setting the time. But that shouldn't be an issue because you can first fetch the date/time, change the date portion of it and then save it back.

WMI将允许您执行此操作.这是

WMI will allow you to do that. Here's a TechNet post on how to do that using VBScript but it relies on WMI so you can extract to the language you're using. Alternatively WMI Code Creator can help you get the code you need. Note however that setting the system time requires privileges so you'll likely need to connect to the server using an account that has sufficient privileges.

还应指出,大多数已连接Internet的现代计算机都会重置其时间,以使其与被同步到的时间服务器相匹配.因此,设置系统时间不会有太大差异,除非漂移太高而无法同步或没有 完全使用时间服务器.在Windows 10上,该信息在系统视图之一中可用,但是对于较旧的OS,则必须寻找该信息.

Should also point out that most modern computers that are Internet connected will reset their time to match the time server they are synced to. So setting the system time won't make much difference unless the drift is too high for it to sync or it isn't using a time server at all. On Windows 10 that information is available in one of the system views but for older OSes you'll have to hunt for it.

迈克尔·泰勒
http://www.michaeltaylorp3.net

Michael Taylor
http://www.michaeltaylorp3.net


这篇关于在远程服务器上设置系统日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆