In this hands-on lab, you are tasked with finding system information from multiple VMs using PowerShell. Instead of logging into each server, it’s much easier to perform PowerShell commands from a single terminal. Using the `Enter-AzVM` command, you will be able to access the Azure VM from a PowerShell session and perform all the necessary commands, just as if you were logged into the machine.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Open Cloud Shell and Navigate to Your Resource Group
- Open Cloud Shell and open the PowerShell prompt.
- Change directory into the resource group for this hands-on lab.
- Run
Get-AzVM
to get a list of all VMs.
- Enable PowerShell Remoting for Both VMs
Enable PowerShell remoting for the Windows VM:
Enable-AzVMPSRemoting -Name 'winVM' -Protocol https -OsType Windows
Enable PowerShell remoting for the Linux VM:
Enable-AzVMPSRemoting -Name 'linvm' -Protocol ssh -OsType Linux
- Enter the VM and Get the Memory Utilization
Access the Windows VM:
Enter-AzVM -Name 'winVM' -Credential (Get-Credential)
Access the Linux VM:
Enter-AzVM -Name 'linVM' -Credential (Get-Credential)
Once logged in, perform the following command on a Windows VM:
systeminfo | findstr "Virtual Memory"
Once logged in, perform the following command on a Linux VM:
grep MemTotal /proc/meminfo