PowerShell Looping constructs

PowerShell Looping constructs Please provide screen shots and answer all questions: 1. Use PowerShell to view the event viewer! What do you mean what cmdlet? 2. Use “Get-WmiObject –List” cmdlet to find only those that have the text “CIM” in its name Experiment with –Match, -Contains, -Like. 3. Explain what’s happening here… $i=0 $Type = "Win32" $WMI = Get-WmiObject -List | Where-Object {$_.name -Match $Type} Foreach ($w in $WMI) {$i++} Write-Host 'There are '$i' types of '$Type 4. Check the status of NetLogon service. 5. Get the top 10 events from the System event log where the log type is Information and the event id is 7036. Display only the EventId, Message and time event was generated 6. Use PowerShell cmdlet to clear the log entries a. Can you use a PowerShell cmdlet to capture the clear log event? 7. Create a folder called TestFolder in the Scripts folder using PowerShell cmdlets Using loops I want you to create 5 files inside TestFolder – PS WK3 01.txt PS WK3 02.txt PS WK3 03.txt PS WK3 04.txt PS WK3 05.txt a. watch the spaces “PS<space>WK3<space>01.txt”. NOTE: You have to check if a file with that name already exists in that folder. b. Later, you have to rename the files to look like this: PS-TEST-WK3-01.txt PS-TEST-WK3-02.txt PS-TEST-WK3-03.txt PS-TEST-WK3-04.txt PS-TEST-WK3-05.txt You can use the –Confirm switch or –Whatif switch 8. Something cool and … disturbing… think Matrix!! a. Get-Process | Format-Table * b. What do you think is going on? 9. Try this cmdlet: $date = Get-Date $date. <cycle through the different properties> You are going to use this later… Get-EventLog -Logname * <<- lists the different logs Get-EventLog –Logname “Win<Tab>” let it autocomplete - Pick the top 10 events  -newest 10 - Filter only the “Information” type logs… - Filter only the information type logs written today!! Can you use the $date variable here perhaps? o Can you do this inline instead of using variable? 10.

Unlock Your Academic Potential with Our Expert Writers

Embark on a journey of academic success with Legit Writing. Trust us with your first paper and experience the difference of working with world-class writers. Spend less time on essays and more time achieving your goals.

Order Now