To get the Azure VM deallocated date using PowerShell we can use the below command.PS C:\> Get-AzVM -VMName Win2k16VM1 -ResourceGroupName TestVMRG -StatusHere it will retrieve the PowerState of the VM.To retrieve the date when the VM was deallocated, we need to filter out the result.PS C:\> $vm = Get-AzVM -VMName Win2k16VM1 -ResourceGroupName TestVMRG - Status PS C:\> $vm.Statuses[0].TimeOutputSaturday, June 19, 2021 12:49:16 PM
There are the below Power State for the Azure VM.Starting − The virtual machine is being started.Running − The virtual machine is currently runningStopping − The virtual machine is being stoppedStopped − The virtual machine is currently stopped and but still incur compute charges.Deallocating − The virtual machine is being deallocated.Deallocated − The virtual machine is deallocated and released all the resources and does not incur the charges.- − The Power State of the virtual machine is unknown.To get the status of the virtual machine, there are two ways.PS C:\> Get-AzVM -VMName Win2k16VM1 -StatusOutputYou can see the PowerState of the ... Read More
First, to retrieve the size of the Azure VM that is currently applied, we can use the below command.PS C:\> $vm = Get-AzVM -VMName VMName PS C:\> $vm.HardwareProfile.VmSizeOutputStandard_B1msNow to get the size of the Azure VMs available in the particular location we can use the below command.PS C:\> Get-AzVMSize -VMName $vm.Name -ResourceGroupName $vm.ResourceGroupNameYou will get all the available sizes for Azure VM.Now we need to set the VM size. Here we will first set the size of the VM and then we will update the virtual machine to take the updated size.PS C:\> $vm.HardwareProfile.VmSize = 'Standard_B2ms' PS C:\> Update-AzVM -VM ... Read More
To get the Azure images available from specific publishers like Microsoft at a specific location, we can use the Get-AzVMImageOffer command. For example, the below command will retrieve all the images available in the EastUs location and from the publisher MicrosoftWindowsServer.PS C:\> Get-AzVMImageOffer -Location Eastus -PublisherName "MicrosoftWindowsServer"OutputFrom the RedHat,PS C:\> Get-AzVMImageOffer -Location Eastus -PublisherName RedHatOutput
You can get the Azure images and the Publisher name from the Azure MarketPlace. To get the Azure Images publishers available at the specific location using PowerShell, we can use the GetAzVMImagePublisher command and need to provide the location to get the available publishers.For Example, PS C:\> Get-AzVMImagePublisher -Location EastusThe above command will get all the image publishers available at that location. To get only the publishers, you can filter out the output.PS C:\> Get-AzVMImagePublisher -Location Eastus | Select PublisherNameOutputxcontentptyltd-1329748 xendata-inc xfinityinc xilinx xoriantsolutionspvtltd xtremedata xyzrd-group-ou yellowfin yellowfininternationalptyltd1616363974066 yokogawarentalleasecorporation your-shop-onlineYou can filter the specific publisher as shown below.PS C:\> Get-AzVMImagePublisher ... Read More
To retrieve the OS Caching setting of the Azure VM using CLI, we can use the below command.PS C:\> az vm show -n VMName -g VMRG --query storageProfile.osDisk.caching -otsvOutputReadWriteYou can also get the caching setting on the Azure VM without using the resource group name using the command below.PS C:\> az vm list --query "[?name=='vmname'].storageProfile.osDisk.caching" -otsvIf you need to retrieve the setting for all VMs then,PS C:\> az vm list --query "[].{VMName:name, ResourceGroup:resourceGroup, caching:storageProfile.osDisk.caching}" -otable
To retrieve the Azure VM OS using Azure CLI, we can use the “az vm” command but before that, need to make sure that you are connected to the Azure cloud and the subscription.PS C:\> az vm show -n VMName -g VMRG --query "[storageProfile.imageReference.offer]" -otsvORPS C:\> az vm show -n VMName -g VMRG --query storageProfile.imageReference.offer - otsvOutputWindowsServerTo get the OS SKU or the operating system version, you can use, PS C:\> az vm show -n VMName -g VMRG --query "[storageProfile.imageReference.sku]" -otsvOutput2016-DatacenterYou can also use the below command to get the OS of the VM without providing the resource group name.PS C:\> ... Read More
Structure is a collection of different datatype variables, grouped together under a single name.Features of structureThe features of structure in the C programming language are as follows −It is possible to copy the contents of all the structure elements of different datatypes to another structure variable of its type by using an assignment operator.For handling the complex datatypes, it is better to create structure within another structure, which is called nested structures.It is possible to pass an entire structure, individual elements of structure and an address of structure to a function.It is possible to create structure pointers.ProgramFollowing is the C ... Read More
The user has to enter the order of two matrices and elements of two matrices. Then, these two matrix are compared.If both matrix elements and size are equal, then it displays that the two matrices are equal.If size of matrix is equal but the elements are not equal, then it displays that the matrix can be compared but is not equal.If the size and elements are not matched, then it displays that the matrices cannot be compared.ProgramFollowing is the C program to compare if the two matrices are equal or not −#include #include main(){ int A[10][10], B[10][10]; ... Read More
ProblemWrite a code to sort all the rows of matrix in an ascending order and all columns in the descending order. The size of matrix and elements of matrix are given by user at runtime.SolutionThe solution to sort all the rows of matrix in an ascending order and all columns in the descending order in the C programming language is explained below −The logic used to sort the rows in an ascending order is as follows −for (i=0;i
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP