Introduction to Powershell For Penetration Testing

Vipul Vyas
2 min readFeb 5, 2021

--

It is my First Blog and I hope you like it, Lets get start ….

Windows PowerShell is a powerful tool for automating tasks and simplifying configuration and can be used to automate almost any task in the Windows ecosystem, including active directory and exchange.

Windows PowerShell comes installed by default in every Windows, starting with Windows 7 SP1 and Windows Server 2008 R2 SP1.

https://itblog.ldlnet.net/wp-content/uploads/2019/01/powershell-2.png

Attackers can gather internal users data with powershell and also exploit it. But why IT security staff can’t master enough Powershell to start own Pen testing and begin to understand the hacker mindset ? , that is the question yet. Lets start with small Powershell script…

Open Integrated Scripting Environment (ISE) for scripting

ise

Lets Create small program which show us Power of Powershell

Question : Create CSV file from all process from service manager not give proper readable output but powershell do it better and readable.

first we see all the steps as a individually and after that we combine all of them.

step 1 : get all services running and stopped both.

get-service

step 2 : stopped service where-object for condition

where-object Status -eq 'Stopped'

step 3 : save in CSV file

export-csv path

Combine all above

get-service | where-object Status -eq 'Stopped' | select-object Status, name, Displayname | export-csv path

It show you the services which is stopped and save it’s Status, name and Displayname to csv file.

In this Example we can see powershell is same as bash (for linux) and others and also easy to use.

hey guys please if you like or don’t like give feedback or suggestion so i can improve it.

Thank You…

Continue… part 2

--

--

No responses yet