When working with Windows systems across an enterprise, this question often arises: “How do I do <some task> in PowerShell?” In an administrator’s perfect world, anybody who designs a feature with management implications also supports (via PowerShell cmdlets) the tasks that manage that feature. Many management tasks have been around longer than PowerShell, though, so the answer can sometimes be, “The same way you did it before PowerShell.”
That’s not to say that your life as an administrator doesn’t improve with the introduction of PowerShell, however. Pre-PowerShell administration tasks generally fall into one of several models: command-line utilities, Windows Management Instrumentation (WMI) interaction, registry manipulation, file manipulation, interaction with COM objects, or interaction with .NET objects.
PowerShell makes it easier to interact with all these task models, and therefore makes it easier to manage functionality that depends on them.
You want to join a computer to a domain or workgroup.
parameter of the
Add-Computer cmdlet to add a computer
to a domain. Use the
-WorkGroupName parameter to add
it to a workgroup.
PS > Add-Computer -DomainName MyDomain -Credential MyDomain\MyUser PS > Restart-Computer
Add-Computer cmdlet’s name is fairly self-descriptive: it lets you add a computer to a domain or workgroup. Since a domain join only ...