external help file | Module Name | online version | schema |
---|---|---|---|
Wsl-help.xml |
Wsl |
2.0.0 |
Changes the settings of a WSL distribution.
Set-WslDistribution [-Name] <String[]> [-Version <Int32>] [-Default] [-Passthru] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-WslDistribution -Distribution <WslDistribution[]> [-Version <Int32>] [-Default] [-Passthru] [-WhatIf]
[-Confirm] [<CommonParameters>]
The Set-WslDistribution
cmdlet changes the settings of a WSL distribution. The distribution can be
specified by name, or piped in from the Get-WslDistribution
cmdlet.
This cmdlet wraps the functionality of wsl.exe --set-default
and wsl.exe --set-version
.
Set-WslDistribution Ubuntu -Default
This example makes the distribution named "Ubuntu" the default.
Get-WslDistribution -Version 1 | Set-WslDistribution -Version 2 -Passthru
Name State Version Default
---- ----- ------- -------
Ubuntu-18.04 Running 2 False
Debian Stopped 2 False
This example converts all version 1 distributions to version 2. It uses the Passthru parameter to return the WslDistribution objects for the affected distributions.
Specifies that the distribution should be made the default distribution. If the input specifies multiple distributions, the last one processed will be the default after the command finishes.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the distribution whose settings to change.
Type: WslDistribution[]
Parameter Sets: Distribution
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies the name of a distribution whose settings to change.
Type: String[]
Parameter Sets: DistributionName
Aliases: DistributionName
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: True
Specifies that a WslDistribution object is to be passed through to the pipeline representing the distribution whose settings were changed.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the WSL distribution version to convert the distribution to, either 1 or 2. Converting a distribution may take several minutes.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
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.
You can pipe an object retrieved by Get-WslDistribution
to this cmdlet.
You can pipe a distribution name to this cmdlet.
See Get-WslDistribution
for more information.