Skip to content

Commit

Permalink
Add example showing multiple services
Browse files Browse the repository at this point in the history
  • Loading branch information
sdwheeler committed Sep 20, 2023
1 parent e08d651 commit 3dd0090
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 8 deletions.
20 changes: 19 additions & 1 deletion reference/5.1/Microsoft.PowerShell.Management/Set-Service.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,23 @@ Set-Service -InputObject $S -Status Stopped
in the variable, `$S`. `Set-Service` uses the **InputObject** parameter and specifies the object
stored `$S`. The **Status** parameter sets the service to **Stopped**.

### Example 7: Set the startup type for multiple services

The `Set-Service` cmdlet only accepts one service name at a time. However, you can pipe multiple
services to `Set-Service` to change the configuration of multiple services.

```powershell
Get-Service SQLWriter,spooler |
Set-Service -StartupType Automatic -PassThru |
Select-Object Name, StartType
```

```Output
Name StartType
---- ---------
spooler Automatic
SQLWriter Automatic
```
## PARAMETERS

### -ComputerName
Expand Down Expand Up @@ -351,7 +368,8 @@ Accept wildcard characters: False

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand Down
28 changes: 25 additions & 3 deletions reference/7.2/Microsoft.PowerShell.Management/Set-Service.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 12/12/2022
ms.date: 09/20/2023
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/set-service?view=powershell-7.2&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Set-Service
Expand Down Expand Up @@ -202,6 +202,24 @@ The **SecurityDescriptor** is stored in the `$SDDL` variable. `Set-Service` uses
parameter to specify the **BITS** service. The **SecurityDescriptorSddl** parameter uses
`$SDDL` to change the **SecurityDescriptor** for the **BITS** service.

### Example 10: Set the startup type for multiple services

The `Set-Service` cmdlet only accepts one service name at a time. However, you can pipe multiple
services to `Set-Service` to change the configuration of multiple services.

```powershell
Get-Service SQLWriter,spooler |
Set-Service -StartupType Automatic -PassThru |
Select-Object Name, StartType
```

```Output
Name StartType
---- ---------
spooler Automatic
SQLWriter Automatic
```

## PARAMETERS

### -Credential
Expand Down Expand Up @@ -341,7 +359,10 @@ Accept wildcard characters: False

### -SecurityDescriptorSddl

Specifies the **SecurityDescriptor** for the service in **Sddl** format.
Specifies the **SecurityDescriptor** for the service in **Sddl** format. The account calling
`Set-Service` with this parameter must have the WRITE_DAC and WRITE_OWNER permissions. For more
information, see
[Service security and access rights](/windows/win32/services/service-security-and-access-rights).

```yaml
Type: System.String
Expand Down Expand Up @@ -443,7 +464,8 @@ Accept wildcard characters: False

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand Down
23 changes: 21 additions & 2 deletions reference/7.3/Microsoft.PowerShell.Management/Set-Service.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 12/12/2022
ms.date: 09/20/2023
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/set-service?view=powershell-7.3&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Set-Service
Expand Down Expand Up @@ -202,6 +202,24 @@ The **SecurityDescriptor** is stored in the `$SDDL` variable. `Set-Service` uses
parameter to specify the **BITS** service. The **SecurityDescriptorSddl** parameter uses
`$SDDL` to change the **SecurityDescriptor** for the **BITS** service.

### Example 10: Set the startup type for multiple services

The `Set-Service` cmdlet only accepts one service name at a time. However, you can pipe multiple
services to `Set-Service` to change the configuration of multiple services.

```powershell
Get-Service SQLWriter,spooler |
Set-Service -StartupType Automatic -PassThru |
Select-Object Name, StartType
```

```Output
Name StartType
---- ---------
spooler Automatic
SQLWriter Automatic
```

## PARAMETERS

### -Credential
Expand Down Expand Up @@ -446,7 +464,8 @@ Accept wildcard characters: False

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand Down
23 changes: 21 additions & 2 deletions reference/7.4/Microsoft.PowerShell.Management/Set-Service.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 12/12/2022
ms.date: 09/20/2023
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/set-service?view=powershell-7.4&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Set-Service
Expand Down Expand Up @@ -202,6 +202,24 @@ The **SecurityDescriptor** is stored in the `$SDDL` variable. `Set-Service` uses
parameter to specify the **BITS** service. The **SecurityDescriptorSddl** parameter uses
`$SDDL` to change the **SecurityDescriptor** for the **BITS** service.

### Example 10: Set the startup type for multiple services

The `Set-Service` cmdlet only accepts one service name at a time. However, you can pipe multiple
services to `Set-Service` to change the configuration of multiple services.

```powershell
Get-Service SQLWriter,spooler |
Set-Service -StartupType Automatic -PassThru |
Select-Object Name, StartType
```

```Output
Name StartType
---- ---------
spooler Automatic
SQLWriter Automatic
```

## PARAMETERS

### -Credential
Expand Down Expand Up @@ -446,7 +464,8 @@ Accept wildcard characters: False

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand Down

0 comments on commit 3dd0090

Please sign in to comment.