< Back

Set-d00mPowerShellDefaultShell

Mon Jan 13, 2020 8:35 am

NAME Set-d00mPowerShellDefaultShell



SYNOPSIS

Sets the default shell to PowerShell





SYNTAX

Set-d00mPowerShellDefaultShell [-ComputerName <String[]>] [-Credential <PSCredential>] [-Restart]

[<CommonParameters>]



Set-d00mPowerShellDefaultShell [-VMName <String[]>] [-VMCredential <PSCredential>] [-Restart] [<CommonParameters>]





DESCRIPTION

Sets registry key to specify PowerShell as default shell.

(HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon\\Shell)





PARAMETERS

-ComputerName <String[]>

Computer names



Required? false

Position? named

Default value $env:COMPUTERNAME

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-Credential <PSCredential>

Computer name admin credential



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-VMName <String[]>

VM names



Required? false

Position? named

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-VMCredential <PSCredential>

VM admin credential



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Restart [<SwitchParameter>]

Restart computer after completion



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Set-d00mPowerShellDefaultShell -Credential (Get-Credential)



This example sets PowerShell as the default shell on the local machine using

the supplied credentials.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Set-d00mPowerShellDefaultShell -ComputerName Computer1, Computer2 -Credential (Get-Credential)



This example sets PowerShell as the default shell on the remote computers using

the supplied credentials.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Read-Content c:\\computers.txt | Set-d00mPowerShellDefaultShell



This example sets PowerShell as the default shell on the list of computers read from

the file using the user's current credentials.









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>(Get-AdComputer -Filter {(Enabled -eq 'true')}).Name | Set-d00mPowerShellDefaultShell -Credential

(Get-Credential)



This example sets PowerShell as the default shell on the computers returned from the

Get-AdComputer cmdlet using the supplied credentials.









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Set-d00mPowerShellDefaultShell -VMName vm01, vm02 -VMCredential (Get-Credential)



This example sets PowerShell as the default shell on the virtual machines vm01 and vm02

using the supplied VM administrator credentials









-------------------------- EXAMPLE 6 --------------------------



PS C:\\>Set-d00mPowerShellDefaultShell -ComputerName Computer1 -Restart



This example sets PowerShell as the default shell on Computer1 and restarts Computer1

after execution











RELATED LINKS