Skip to content

Create and run a Powershell Script

Firstly: Install Active Directory PowerShell

# Install AD tools
Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools

1. Create your script file

In Powershell, at the path of your choice, create a script file with the .ps1 extension.

New-Item <script-name>.ps1

2. Write your script

# Here you would write your desired powershell commands
echo "This is my script"

3. Run your script

In Powershell, run

C:\Path\to\your\script\<script-name>.ps1

# Or if you are located at script simply run
.\<script-name>.ps1