Question

Exercise 2: Challenge Exercises 1. Write a Powershell script to Check If a Service is Installed...

Exercise 2: Challenge Exercises

1. Write a Powershell script to Check If a Service is Installed and Working

2. Write a Powershell to Checks If a File Exists

3. Write a Powershel lfind all the dlls under the Windows folder

4: Write a script sorting process by their start time

5: Write a script to find all files last modified before a certain date. 6: Write a script to find the event log entries that occur most frequently.

7: Write a Powershell script to Count the Temporary Files

8: Write a Powershell script Windows Log Files with 'Errors'

9: Write a Powershell script to filter processes with over 200 handles

USE WINDOWS POWERSHELL, AND SHOW INPUT AND OUTPUT. ALSO SCREEN SHOT A PICTURE OF THE RESULT

0 0
Add a comment Improve this question Transcribed image text
Answer #1

SOLUTION-

(1):- Powershell script to Check If a Service is Installed and Working is given below:-

# Powershell script to Check If a Service is Installed and Working

Clear-Host

$sName = "alerter"
$service = Get-Service -display $sName -ErrorAction SilentlyContinue
If ( -not $service )
{$sName + " NOT INSTALLED ON THIS MACHINE. `n
Did you really mean: " + $sName }
else { $sName + " INSTALLED ON THIS MACHINE"
$sName + "'s status is: " + $service.Status }

-(2):-

Powershell Script to Checks If a File Exists

$strFileName="c:\ROBERT.txt"

If (Test-Path $strFileName){

# // File exists

}Else{

# // File does not exist

}

SOLUTION-(3):-Powershell Script to find all the dlls under the Windows folder

PS C:\Windows> Get-ChildItem c:\windows -include *.dll -recurse | foreach-object { "{0}" -f [System.Diagnostics.FileVersionInfo]::GetVersionInfo($

(4):-

Powershell Script to sorting process by their start time

PS C:Windowssystem32> Get-Process | sort startTime -ea silentlycontinue | ft name,
starttime –AutoSi

SOLUTION-(5):-Powershell Script to find all files last modified before a certain date

Get-ChildItem -Recurse | Where-Object { $_.LastWriteTime -lt "02/02/2018" }

Add a comment
Know the answer?
Add Answer to:
Exercise 2: Challenge Exercises 1. Write a Powershell script to Check If a Service is Installed...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT