Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Windows Admin Scripting Little Black Book- P26:This book may not be duplicated in any way without the express written consent of the publisher, except in the form of brief excerpts or quotations for the purposes of review. The information contained herein is for the personal use of the reader and may not be incorporated in any commercial programs, other books, databases, or any kind of software without written consent of the publisher. Making copies of this book or any portion for any purpose other than your own is a violation of United States copyright laws | Set ACTL CreateObject Agent.Control.2 ACTL.Connected True If Not IsObject ACTL Then Wscript.Echo Microsoft Agent was not found on your system. vblf Please install and try again. Wscript.Quit End If ACTL.Connected True ACTL.Characters.Load aCHAR aCHAR .acs If Err.Number 0 Then Wscript.Echo Could not locate the Agent called aCHAR Wscript.Quit End If Wscript.Echo Press CTRL C to end this script. Set CREF ACTL.Characters aCHAR CREF.MoveTo 200 200 CREF.Show CREF.Play Wave CREF.Play Restpose CREF.Speak Hello my name is Merlin CREF.Play Greet CREF.Play Restpose CREF.Speak I am your personal CPU monitoring assistant CREF.Play Announce CREF.Play Restpose CREF.MoveTo 0 0 CREF.Speak I will now monitor your CPU usage and notify you when an overload occurs. CREF.Play StartListening Computer InputBox Enter the computer name CPU Monitor localhost CPULoad InputBox Enter the CPU overload threshhold CPU threshhold 75 Poll InputBox Enter the polling interval Poll Interval 5 If Computer Then Computer Localhost If CPULoad Then CPULoad 75 If Poll Then Poll 5 Set ProLoad. GetObject winmgmts impersonationLevel impersonate Computer root cimv2 .ExecNotificationQuery SELECT FROM InstanceModificationEvent WITHIN Poll WHERE Targetinstance ISA Win32 Processor and TargetInstance .LoadPercentage CPULoad If Err.Number 0 then WScript.Echo Err.Description Err.Number Err.Source End If Do Set ILoad ProLoad.nextevent If Err.Number 0 then WScript.Echo Err.Number Err.Description Err.Source Exit Do Else AMessage ILoad.TargetInstance.DeviceID is overloaded at _ ILoad.TargetInstance.LoadPercentage CREF.Stop CREF.Show CREF.Play GetAttention CREF.Play GetAttentionContinued CREF.Play GetAttentionReturn CREF.Speak AMessage RandomAction End If Loop Sub RandomAction ulimit 5.0 llimit 1.0 Randomize X Int ulimit - llimit Rnd llimit Select Case X Case 1 CREF.Play Acknowledge Case 2 CREF.Play Alert Case 3 CREF.Play Explain Case 4 CFEF.Play Sad Case 5 CFEF.Play Uncertain End Select End Sub Note The highlighted code .