This is the list of commandlets for standard Windows automation.
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Name of the user to create | Bob |
Password | string | ![]() |
Associated password | Password1 |
New-LocalUser -Name "Bob" -Password "Password1"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Name of the user to delete | Bob |
Delete-LocalUser -Name "Bob"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Username | string | ![]() |
Name of the user to add | Bob or Domain/Bob |
Group | string | ![]() |
Group to add the user to | IIS_WPG |
Add-UserToGroup -Username "Bob" -Group "IIS_WPG"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Username | string | ![]() |
Name of the target user | Bill or Domain/Bill |
Group | string | ![]() |
Group to remove the user from | IIS_WPG |
Remove-UserFromGroup -Name "Bob" -Group "IIS_WPG"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Path | string | ![]() |
Target folder | C:\My\Folder |
Username | string | ![]() |
User to give permissions to | Bill |
Permission | FileSystemRights | ![]() |
Type of access to grant/revoke | Read |
Modifier | AccessControlType | ![]() |
New access value | Allow |
Set-FolderPermissions -Path "C:\My\Folder" -Username "Bob" -Permission "Write" -Modifier "Allow"
Name | Type | Required | Description | Example |
---|---|---|---|---|
MachineName | string | Target machine | ComputerName |
Get-SharedFolders
Name | Type | Required | Description | Example |
---|---|---|---|---|
Path | string | ![]() |
Path to an existing folder | C:\Path\To\Folder |
Name | string | ![]() |
Name of the share | Public |
Type | int | Share type | 0 | |
MaxConnectionsAllowed | int | Maximum number of concurrent connections | 25 | |
Description | string | Share description | Public shares | |
Password | string | Share password | P@ssw0rd | |
Access | Win32_SecurityDescriptor | Access restrictions |
New-SharedFolder -Path "C:\Public" -Name "Public"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Name of the share to remove | Public |
Remove-SharedFolder -Name "Public"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Task name | MyTask |
$task = Get-ScheduledTask -Name "MyTask" Write-Host $task.TaskName
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Task name | MyTask |
Start-ScheduledTask -Name "MyTask"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Task name | MyTask |
Enable-ScheduledTask -Name "MyTask"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Task name | MyTask |
Disable-ScheduledTask -Name "MyTask"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Task name | MyTask |
Path | string | ![]() |
Path to the program to run | MyTask |
User | string | ![]() |
Username to run the task under | MyTask |
Password | string | ![]() |
Corresponding password | MyTask |
AtStartup | switch | Run the task when the computer starts | ||
WhenIdleFor | int | Run the task when the computer has been idle for N minutes | 10 (minutes) | |
OnceOnThe | DateTime | Run the task once on a specific date | "04-17-2010"(regional format depends on the computer) | |
Every | int | Run the task on a schedule | ||
Minute(s) | switch | Run it every N minutes | 2 | |
Hour(s) | switch | Run it every N hours | 2 | |
Day(s) | switch | Run it every N days | 2 | |
Week(s) | switch | Run it every N weeks | 2 | |
Month(s) | switch | Run it every N months | 2 | |
On | string | Run it on specific days | "Mon,Tue" (list of days) | |
In | string | Run it on specific months | "Jan,Feb,Mar" (list of months) | |
At | DateTime | Time to run the task | 6pm or 18:00 (24 hour clock) | |
OnThe | int | Day number on which to run the task (in month mode) | 17 | |
OnTheFirst | string | Run the task on the first day of the month | "Mon" (first 3 letters) | |
OnTheLast | string | Run the task on the last day of the month | "Mon" (first 3 letters) |
#The basic creation parameters are: New-ScheduledTask -Name "MyTask" -Path "C:\Path\To.exe" -User "Username" -Password "Pass" #They should be followed by one of the following schedule types: -AtStartup -WhenIdleFor 10 -OnceOnThe "17-04-2010" -Every 1 -Minute -Every 5 -Minutes -Every 2 -Hours -Every 10 -Days -At 9pm -Every 2 -Weeks -On "Mon,Wed,Fri" -At 6pm -Every 3 -Months -OnThe 17 -At 4am -Every 1 -Month -In "Jan,Feb,Mar" -OnThe 17 -At 11pm -Every 1 -Month -OnTheLast "Wed" -At 2am
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Name of the task to delete | MyTask |
Remove-ScheduledTask -Name "MyTask"
Name | Type | Required | Description | Example |
---|---|---|---|---|
UncPath | string | ![]() |
Path to mount | \\Server\Folder |
DriveLetter | string | ![]() |
Letter to mount the path under | L |
New-NetworkDrive -UncPath "\\Server\Folder" -DriveLetter "L"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Name of the service to query | MyService |
Find-Service -Name "MyService"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Name of the target service | MyService |
Username | string | ![]() |
Fully qualified username to run under | CORP\Bob |
Password | string | ![]() |
Corresponding password | Password1 |
Set-ServiceCredentials -Name "MyService" -Username "CORP\Bob" -Password "Password1"
Name | Type | Required | Description | Example |
---|---|---|---|---|
Name | string | ![]() |
Name of the service to update | MyService |
NewVersionPath | string | ![]() |
Path to the new executable or folder | C:\Builds\ServiceX\Version2 |
Update-Service -Name "MyService" -NewVersionPath "C:\Builds\ServiceX\AFewFiles" Update-Service -Name "MyService" -NewVersionPath "C:\Builds\ServiceY\JustAnExe.exe"