2017年10月21日星期六

Remote management of Hyper-V hosts

Remote management using Hyper-V Manager in domain environment
Open Hyper-V Manager, Then, In the left pane, right-click Hyper-V Manager, and select Connect To Server.
























Select Another Computer,and type the Name or IP of the computer you want to manage.












You can also click Browse to open a standard Select Computer search box,in wich you can search for a computer name.






















Click OK,The computer you want to manage will be appears in the left pane. In the left pane, select the computer you want to manage. The virtual machines on that computer appear in the center pane.



































Remote management using Hyper-V Manager in WorkGroup environment
Connecting to a remote Hyper-V server when both computers are joined to the same AD DS domain is easy. The computers use Kerberos for authentication, which is brokered by a domain controller. When the computers are not in the same domain, or not in any domain, the authentication process is more complicated, because the computers cannot use Kerberos. Therefore, you must configure them to use the Credential Security Support Provider (CredSSP) authentication protocol instead.

On the remote (managed) server:
Creates the firewall rules needed to allow the incoming management traffic using enable-psremoting cmdlet
Enables the use of CredSSP for authentication using enable-wsmancredssp cmdlet













On the local (managing) computer:
Add the fully-qualified domain name of the Hyper-V server to be managed to the local system's WSMan trusted hosts list.
set-item wsman:\localhost\client\trustedhosts -value "hypervserver.domain.com"
enables CredSSP on the client
enable-wsmancredssp -role client -delegatecomputer "hypervserver.domain.com"
Note:hypervserver.domain.com" is Hyper-v Server's FQDN

















On the Select Computer page, Select you want connetc to Hyper-v Server, and check Connect as another user: <none>. Then Select Set User












Type the user name and password with administrative privileges.
















Select OK,Connect to Hyper-v.














Remote management using PowerShell
To connect to the remote Hyper-V server from an administrative PowerShell session, you must first create a session, using the New-PSSession cmdlet











To enter the session, you use the Enter-PSSession cmdlet
Note:1 is session ID












If you are not currently logged on with an account that has administrative privileges on the remote server, you can enter a session using another account with the following command:
enter-pssession # -credential DomainName\UserName


















Now you can use the relevant PowerShell command to manage Hyper-v. Such as displays the virtual machine running on the Hyper-v Server using Get-VM















Exit the session using Exit cmdlet


Hyper-v Introduction and Install

Introduction
Hardware requirements:
  • 64-bit processor
  • Support hardware-assisted virtualization(Intel VT;AMD AMD-v)and has been enabled
  • Hardware-enforced Data Execution Prevention (DEP)
  • Intel eXecuted Disable (XD) and AMD No eXecute (NS).
  • Enough memory - plan for at least 4 GB of RAM. More memory is better.

To determine whether the computer meets the hardware requirements of the Hyper-v role, you can run the Systeminfo.exe command on PowerShell. At the bottom of the results, the Hyper-v requirements item lists the computer's hypervisor capability.




























Hyper-V hardware limitations
  • support up to 512 logical processors
  • support up to 2,048 virtual CPUs
  • support up to 24 terabytes (TB) of physical memory

 Virtual Machine limit
  • per host can support as many as 1024 active virtual machine
  • each Generation 2 virtual machine can support up to 240 virtual machine and 12 TB of memory
  • each Generation 1 VMs can support up to 64 virtual CPUs and up to 1 TB of memory


Install Hyper-v
Select Add Roles And Features in the Server Manager console
















Click Next



























Select Role-Based or Feature-Based Installation and click Next



























Select the server on which you want to install Hyper-V and click Next



























Select the Hyper-V role check box. And in the pop-up Add Roles and Features wizard dialog box, select Add Feature. Then click Next.



























Click Next



























Click Next



























Select a network adapter as a Virtual switch and click Next



























Click Next



























specify the default locations for virtual hard disk and virtual machine configuration files, and click Next



























Click Install



























After installed, Click Close and restart computer




























You can also install the Hyper-V role with the Install-WindowsFeature cmdlet in PowerShell
Install-WindowsFeature –Name hyper-v -Includemanagementtools –restart









2017年9月30日星期六

Install and configure Nano Server

In Windows Server 2016, Microsoft released Nano Server, a new installation option.  it has no local user interface, no 32-bit application support, and only the most basic configuration controls. There is no support for Remote Desktop to administer the system, you need use  remote PowerShell connection.

Advantage:
  • Extremely small footprint
  • Boot the fast, only few seconds
  • Dramatically faster than Windows Server or Server Core
  • Fewer updates
  • Smaller attack surface
  • Reduced shutdown time
  • Fewer open ports


Management Tools
  • Powershell
  • MMC
  • Server Manager
  • System Center


Install Nano Server
Put the Windows Server 2016 system disk into the CD-ROM, or use the virtual CD-ROM loading the system ISO image. Under D:\NanoServer\NanoServerImageGenerator directory, Where D is your CD-ROM or virtual  CD-ROM letter. Copy three powershell script files to C:\Nano directory. (Note: This directory requires you to create, and the directory used to store the Nano Server VHD file.






















Run as administrator the Powershell and enter “Import-module C:\Nano\NanoServerImageGenerator.psm1”. ( The C:\Nano directory is just copy the file directory, NanoServerImageGenerator. Psm1, is just copy one of the three files.)







NoteIf appears “Running scripts is disabled on this system”error, use the "set-executionpolicy" to select the appropriate Powershell script policy.


Run “New-NanoServerImage -Edition Datacenter -MediaPath D:\ -BasePath c:\nano -TargetPath c:\nano\NanoSvr.vhd -MaxSize 20GB -DeploymentType  Guest”
Edition:The version of the Nano Server, Standard edition or Datacenter edition;
MediaPath: Specifies the path to the root of the Windows Server 2016 installation disk or mounted image.
BasePath:Specify a local path for storing files generated during the creation of the Nano Server, such as Packagers, Nano server.wim, etc
TargetPath:The full path and file name of the Nano Serve disk, the file extension VHD is used for the first generation virtual machine, and the VHDX is for the second generation virtual machine.  
MaxSizeVirtual disk Max size
DeploymentType: Specifies whether the image file should be used on a Hyper-V virtual machine (Guest) or a physical server (Host)
Note: In the process of creation, you need enter the "AdministratorPassword", which is the Administrator password for your Nano Server, and the user is "Administrator".







You can add other parameters that come from defining your Nano Server, such as:
ComputerName: Specifies the computer name that should be assigned to the Nano Server
InterfaceNameOrIndexThe name or index number of the network adapter
Ipv4AddressAddress of IPv4
Ipv4SubnetMask Subnet Mask of IPv4
Ipv4GatewayDefault Gateway of IPv4
Ipv4DnsDNS of IPv4





Create a virtual machine, select "Use an existing virtual hard disk" on the Connect virtual hard disk page, and select "Browse" to select the virtual disk of the Nano Server you created earlier.


























Open the virtual machine, use the Administrator account and password login system; At this point the Nano Server does not join the domain, so the following Domain does not need to fill in, enter the user password, press Enter to enter the system.







Configuration Nano Server
After entering the system, we can carry out some simple configuration of the system, such as;
Networking: Configuration Network
Inbound Firewall Rules and Outbound Firewall Rules:Inbound and outbound rules for firewalls
Up/Dn: Move the cursor up and down
ESC: return to the previous page, here (home page) is canceled
F5Refresh
Ctrl + F6Restart
Ctrl + F12: Shutdown
EnterSelect





Select Networking to configure the network, then select the network adapter;


Here is the network card that some information, such as MAC, IP, etc., can be configured through F11 IPv4, F12 configuration IPv6;





The default is through the DHCP to obtain the IP address, if you want to change to manual, select F4



At this point the status of DHCP into a Disable, in the following input IP, subnet and default gateway, through the Enter to save;



save? Continue to press Enter;



Continue via Enter or ESC to return to the Network Adapter Settings page



Select the firewall rule



Select the firewall rules you want to change



Change the status of Enable by F4, Yes/No


Add the Nano Server to the domain
Run as administrator on the domain controller "djoin /provision /domain <You Domain Name> /machine Nanosvr1 /savefile  <FileName>"



Open Active Directory Users and Computer, select the OU you want to store the Nano Server, right-click to select the new computer, enter the Nano Server computer name;




















Access \\Nano Server IP or Computer Name\C$, and copy the files created through the Djoin command to the Nano Server's C root directory


















Note: To access the share normally, you need to open the File and Printer Sharing rule for the firewall




Open the Powershell, use New-PSSession to create a new session, and then use Enter-PSSession to enter the session;
Since the DNS of my remote computer is not able to resolve the Nano Server, I am using IP Address here;




Run “djoin /requestodj /loadfile <FileName> /Windowspath C:\Windows /Locals”. The FileName of the offline join domain file



Restart the Nano Server, then you can use the Domain login, and you can view the Nano Server has joined the domain;




At this point you can manage the Nano Server through the Server Manager, and add the Nano Server to the Server Manager



Once added, right-click the Nano Server and select Windows Powershell