Software & Coding Articles

Page 25 of 83

How to stop the Azure VM using Azure CLI in PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Sep-2021 4K+ Views

To stop the azure VM using Azure CLI we can use the az vm stop command. Before running this command make sure that you are connected to the Azure account and the proper Azure subscription.When we run this command, we need to provide the Azure VM name (-n) and the resource group name (-g).PS C:\> az vm stop -n Win2k16VM1 -g TESTVMRG --verboseThe above command will stop the Azure VM Win2k16VM1 from the resource group TestVMRG. Alternatively, you can also use the full parameter name as shown below.PS C:\> az vm stop --name win2k16vm1 --resource-group testvmrgThis command will wait until ...

Read More

How to start the Azure VM using Azure CLI in PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Sep-2021 1K+ Views

To start the stopped Azure VM using Az CLI, we can use the az vm start command. Before starting the azure VM, make sure that you are connected to the desired subscription and the Azure cloud account.To start the specific VM, we will use the command below.PS C:\> az vm start -n vmname -g RGname --verboseOr you can use,PS C:\> az vm start --name vmname --resource-group RGName --verboseWhen you start the multiple VMs, you can specify the “--no-wait” parameter.PS C:\> az vm start -n vmname -g RGname –no-wait

Read More

How to deallocate the Azure VM using Azure CLI in PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Sep-2021 3K+ Views

To deallocate the Azure VM using Azure CLI, we need to use the VM deallocation command az vm deallocate and need to provide the name of the VM and the resource group of the VM.Before running the deallocation command, make sure that you are connected to the proper azure subscription and the azure account.PS C:\> az vm deallocate -n VMName -g RGName --verboseOr you can usePS C:\> az vm deallocate --name VMName --resource-group RGName --verboseIf you are working on the multiple VMs, you can also apply the --no-wait parameter to continue next operation without waiting for the VM to stop.PS C:\> ...

Read More

How to connect to SSH using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Sep-2021 8K+ Views

It is possible to connect the non-windows target machines with the PowerShell using the SSH command in PowerShell. For that, you need to use the below format.ssh username@servernameThe below example shows how we can connect the non-windows target machine.PS C:\> ssh ansible@192.168.0.104OutputOnce you run this command the first time for any new server the setting will be added to the path .ssh/known_hosts in the user profile.

Read More

How to delete the windows certificate using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Sep-2021 8K+ Views

To delete the Windows certificate using PowerShell, we can use the Remove-Item command.Suppose you know the thumbprint of the certificate then to retrieve all the certificates that use that particular thumbprint, we will use the below command.PS C:\> gci cert:\ -Recurse | where{$_.Thumbprint -eqOutputTo remove the certificates, we will pipeline the Remove-Item command.PS C:\> gci cert:\ -Recurse | where{$_.Thumbprint -eq '920B033462B2FE268E6F9679F8621AEDC78D506C'} | Remove-Item -Force -VerboseOutputOr if you have the Subject name, then instead of the Thumbprint property, you can use the subject name.PS C:\> gci cert:\ -Recurse | where{$_.Subject -eq "DemoCert"} | Remove-Item -Force - VerboseTo remove the certificate on ...

Read More

How to retrieve the Azure VM network security group (NSG) using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Sep-2021 1K+ Views

To retrieve the Azure VM NSG name using PowerShell, we first need to retrieve the NIC name of the VM.PS C:\> $vm = Get-AzVM -VMName Win2k16VM1 PS C:\> $vmnic = $vm.NetworkProfile.NetworkInterfaces.Id.Split('/')[-1]The above command will retrieve the name of the VM. To get the network security Group (NSG) name, we can use the below command.PS C:\> (Get-AzNetworkInterface -Name $nic).NetworkSecurityGroup.Id.Split('/')[-1]The above command will retrieve the name of the VM. To get the network security Group (NSG) name, we can use the below command.PS C:\> (Get-AzNetworkInterface -Name $nic).NetworkSecurityGroup.Id.Split('/')[-1]You can use the below code to get all the details.Get-AzVM -VMName Win2k16VM1 | Select Name, ...

Read More

How to retrieve the Azure VM deallocated date using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Sep-2021 1K+ Views

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

Read More

How to change the size of the Azure VM using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Sep-2021 751 Views

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

How to get the Azure Image publishers available at the location using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Sep-2021 386 Views

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

How to retrieve the OS of the Azure VM using Azure CLI in PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Sep-2021 2K+ Views

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
Showing 241–250 of 825 articles
« Prev 1 23 24 25 26 27 83 Next »
Advertisements