Windows Server 2022 & Powershell All-in-One For Dummies. Sara Perrott

Чтение книги онлайн.

Читать онлайн книгу Windows Server 2022 & Powershell All-in-One For Dummies - Sara Perrott страница 30

Windows Server 2022 & Powershell All-in-One For Dummies - Sara Perrott

Скачать книгу

-ato

Snapshot of using slmgr.vbs to activate Windows Server.

      Time zone

      Much like activation in Windows Server Core, you can set the time zone via sconfig or PowerShell. In this section, I cover both methods. The great thing about PowerShell version is that it will work on Windows Server with Desktop Experience as well.

      SETTING THE TIME ZONE WITH SCONFIG

      Sconfig is the built-in configuration utility in Windows Server Core. Because it's a simple text-based menu, it provides a simple way for administrators to configure the time zone without needing scripting knowledge to do so.

      1 From the sconfig utility, type 9 to go into the settings for Date and Time.The Date and Time dialog box appears.

      2 Click the Change Time Zone button.

      3 Select your time zone from the drop-down list.

      4 If you’re in an area that uses Daylight Saving Time, click the check box next to Automatically Adjust Clock for Daylight Saving Time. If you do not use Daylight Saving Time, leave the box unchecked.

      5 Click OK to exit out of the Time Zone Settings dialog box, and click OK once more to exit out of the Date and Time dialog box.

      SETTING THE TIME ZONE FROM POWERSHELL

      If you prefer to work in PowerShell, you can also set the time zone from there. This utilizes the control command to call the Control Panel’s Date and Time screen.

      In PowerShell, type the following:

       Set-TimeZone -Id <Time Zone Id>

      

If you aren’t sure what your time zone ID is, you can run Get-TimeZone -ListAvailable to see all the time zones you can choose from.

      Computer name and domain

      Setting the name and adding a server to a Windows domain are some of the most common activities that system administrators do with new servers. With Windows Server Core, there are two methods that you should know to complete this task: sconfig (the configuration utility in Windows Server Core) and PowerShell.

      SETTING THE COMPUTER NAME WITH SCONFIG

      The sconfig utility in Windows Server Core makes it simple to change the name of your server with its text-driven menus. Follow these steps:

      1 In the sconfig utility, type 2 to change the computer name.You’re prompted to enter a new name.

      2 Enter the new name, and press Enter.You need to restart your computer to apply the change.

      3 Type yes to reboot now or no to reboot later.

      ADDING TO A DOMAIN WITH SCONFIG

      When the server has the correct name, you may want to add it to a Windows domain. You can do this with the sconfig utility as well.

      1 In the sconfig utility, type 1 to change the domain.

      2 Type D to join a domain and press Enter.

      3 Give it the name of the domain you want to join and then press Enter.

      4 Enter the name of an authorized user and press Enter.

      5 Enter the password of the user and press Enter.You need to restart your computer to apply the change.

      6 Click yes to reboot now or no to reboot later.

      SETTING THE COMPUTER NAME FROM POWERSHELL

      1 From the sconfig utility, type 15 to exit to command line (PowerShell).The PowerShell window opens on your Server Core box.

      2 Use the Rename-Computer command to change the name of your server: Rename-Computer -NewName <new-name>

      3 You get a message stating that the NetBIOS name will be truncated if your name is longer than 15 characters.

      4 If you receive this message, type Y and then press Enter to accept.

      ADDING TO A DOMAIN FROM POWERSHELL

      The ability to script the joining of the domain is a useful skill if you're going to be deploying any quantity of servers. Not only does adding a domain via PowerShell make it simpler to do, but it also helps to ensure that there are no mistakes in the process of joining the domain.

      1 From the sconfig utility, type 15 to exit to command line (PowerShell).The PowerShell window opens on your Server Core box.

      2 Use the Add-Computer command to add the server to the domain.Here’s an example:Add-Computer -DomainName "your_domain_name" -RestartA dialog box appears asking for a username and password.

      3 Enter a username that is authorized to add systems to your Active Directory domain and enter the corresponding password.

      4 Click OK.The server restarts.

      Configure networking

      Before you can set the IP address for the adapter with PowerShell, you need to find out what the index of your interface is. You can do this by typing the following:

       Get-NetAdapter

      The output lists all network adapters. In this case, you want the one that says Ethernet. After you have the index number, you can set the IP address and the DNS servers. On my server, the index is 4.

       New-NetIPAddress -InterfaceIndex

Скачать книгу