重新启动时间后检查服务器

编程入门 行业动态 更新时间:2024-10-25 02:21:10
本文介绍了重新启动时间后检查服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个包含30个服务器的列表,其中包含在excel文件中的预定重新启动时间。我只想检查服务器是否在使用vb脚本重新启动计划后启动,并在检查每个服务器后将状态邮寄给我。

I have a list of 30 servers with its scheduled re-boot time in an excel file. I just want to check whether the servers are up after its scheduled re-boot using vb script and mail me the status after checking each server.

推荐答案

添加一列到您的脚本是否包含每个服务器的tcp / ip地址并且可能执行ping操作? 这样的事情会让你开始使用ping位本身 - 做一个google for 'vbscript smtp mail'我相信你会发现很多代码可以给自己发电子邮件 Add a column to your script with the tcp/ip address of each server and do a ping perhaps ? Something like this will get you started on the ping bit itself - do a google for 'vbscript smtp mail' and Im sure you'll find plenty of code for emailing yourself '========================================================================== ' The following function will test if a machine is reachable via a ping ' using WMI and the Win32_PingStatus Class '========================================================================== If Reachable("10.50.138.48") Then WScript.Echo "Computer is Reachable!" Else WScript.Echo "Computer is Unreachable!" End If Function Reachable(strComputer) ' On Error Resume Next Dim wmiQuery, objWMIService, objPing, objStatus wmiQuery = "Select * From Win32_PingStatus Where Address = '" & strComputer & "'" Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") Set objPing = objWMIService.ExecQuery(wmiQuery) For Each objStatus in objPing If IsNull(objStatus.StatusCode) Or objStatus.Statuscode<>0 Then Reachable = False 'if computer is unreacable, return false Else Reachable = True 'if computer is reachable, return true End If Next End Function

参考: www.visualbasicscript/Ping-WMI-amp-NonWMI-Versions-Functions-amp-Simple-Connectivity-Monitor-m42535.aspx [ ^ ]

更多推荐

重新启动时间后检查服务器

本文发布于:2023-10-28 19:49:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1537605.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重新启动   服务器   时间

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!