Save the script as checkshares.vbs in the folder C:\Scripts. To ensure Type the following script into Notepad. To reduce the amount of Save the script as deleteshare.vbs in the folder C:\Scripts. To ensure
System Administration
Scripting 15 marks before clicking Save:
deleteshare.vbs
c. From the command prompt, change to the C:\Scripts folder if
necessary. Type cscript deleteshare.vbs and then press ENTER. d.
To verify that the Windows folder is no longer being shared, rerun the checkshares.vbs script created in Task 1.
16 System Administration
Scripting
Exercise 5 Create a Script to Check Event Logs
Scenario
In this exercise, you will retrieve specific events from the Application event log. To ensure that only the desired events are retrieved as opposed to all the events in all the event logs, the WMI
query used in the script specifies that the only events to be returned are those from the Application event log that have an EventCode equal to 100.
Note : EventCode 0 is the default event code used by the LogEvent method found in
Windows Script Host. You cannot change this event code, nor can you use a script to write to any event logs other than the Application log. If you need to use custom
event codes then use event code “100” for a custom Application event.
Tasks Detailed steps