Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the actual combat experience of Windows PowerShell?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Today, I would like to talk to you about the actual combat experience of Windows PowerShell, which may not be well understood by many people. in order to make you understand better, the editor summed up the following for you. I hope you can gain something according to this article.

Task 1:

Look for Cmdlet with random birth numbers.

Answer:

Get-Random

Task 2:

Find the Cmdlet that displays the current time and date

Answer:

Get-Date

Task 3:

What is the type of object generated by the Cmdlet of Task # 2?

Answer:

Get-Date | gm

Object type: TypeName:System.Diagnostics.Process

Task 4:

Use Cmdlet and Select-object in Task # 2 to show only the day of the week, as shown in the following example:

DayOfWeek

-

Monday

Answer:

(get-date). Dayofweek

Task 5:

Find the Cmdlet that can display the installed patch (hotfix)

Answer:

Get-hotfix

Task 6:

Use the Cmdlet of Task # 5 to display a list of installed patches, sort the list by installation date, and display only the following columns: installation date, patch ID, installation user.

Answer:

Get-HotFix | Select-Object-Property InstalledOn,Hotfixid,installedby | Sort-Object installedon

Task 7:

Repeat task # 6, but this time sort the results according to the patch description, output the description, patch ID, installation date column, and finally save the results to the HTML file.

Answer:

Get-HotFix | Select-Object-Property Description,hotfixid,installedon | Sort-Object Description | ConvertTo-Html > Hotfix.html

Task 8:

Display the latest 50 lists from the security event log (if the security event list is empty, you can also use other logs, such as system or application logs). The logs are sorted in ascending order of time, and also sorted by index. Displays the index, time, and source of each record. Save this information in a text file (not a HTML file, but a plain text file).

Answer:

Get-EventLog-LogName Security-Newest 50 | Sort-Object-Property TimeWritten,index | Select-Object-Property index,TimeWritten,source | Out-File security.txt

Note:

The name of the Time property is incorrect. You need to use the GM parameter to see what its real property is.

After reading the above, do you have any further understanding of Windows PowerShell's actual combat experience? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report