服务器健康检查脚本 [英] Server health check script

查看:271
本文介绍了服务器健康检查脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个powershell脚本来检查以下内容并将输出复制到文本文件或html文件中。有人可以帮忙吗?感谢您的所有帮助

I am looking for a powershell script to check the following and copy the output to a text file or html file. Can some one please help with the same? Appreciate all your help

1。检查Windows是否已激活,并在输出中显示消息。

1. Check if Windows is activated or not and display a message in the output.

2。确认服务器上只配置了一个默认网关。

2. Confirm there is only one default gateway configured on the server.

3。检查默认网关(自动从网络设置中选择是否可以访问(是否可以))

3. Check if the default gateway (automatically picked up from network settings is reachable (ping-able or not) )

4。显示总和&的输出所有本地磁盘上的可用空间。

4. Show output of total & free space on all local disks.

5。检查DNS服务器是否可访问

5. Check if DNS servers are reachable or not

6。显示服务器的时区。

6. Display the Timezone of the server.

推荐答案

这是很多小件,您可以找到每个搜索的示例TechNet或网络一般。 您需要预先确定的一点是此脚本需要支持的操作系统。 有大量的
新cmdlet仅适用于Windows 8或Server 2012及更高版本,但这对您的需求非常有用。 如果您需要使用它来使用较旧的操作系统,则必须采用不同的方法。

That's a lot of little pieces, and you can probably find examples of each with a search on TechNet or the web in general.  One thing you need to decide up front is what operating systems this script needs to support.  There are a huge number of new cmdlets that only work on Windows 8 or Server 2012 and later, but would be useful for your needs here.  If you need this to work with older operating systems, you'll have to resort to different methods.

这些建议假设您希望支持较旧的操作系统,主要是因为我不使用Windows 8/2012很多,并且不记得所有新的cmdlet名称,从头到尾。  :)

These suggestions assume you want to support older operating systems, mainly because I don't use Windows 8 / 2012 much and don't remember all the new cmdlet names, off the top of my head.  :)


  • 要检查Windows是否已激活,请查看"SoftwareLicensingProduct"和"SoftwareLicensingProduct"。 WMI课程。 您可以在VBScript文件%systemroot%\system32 \slmgr.vbs中查看其用法示例。  (不确定此VBScript是否仍在
    Windows 8 / Server 2012上,或者是否已删除它以支持新的PowerShell cmdlet。)

  • 要检查在IP配置设置(如默认网关)上,查看Win32_NetworkAdapterConfiguration WMI类。

  • 要ping地址,请使用Test-Connection cmdlet。

  • 磁盘的大小和可用空间信息可以在Win32_LogicalDisk WMI类中找到(假设您希望按体积分解,而不是物理磁盘。)

  • 时区信息可以从Win32_OperatingSystem WMI类(CurrentTimeZone属性)获得。


这篇关于服务器健康检查脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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