Chirag Nagrekar has Published 468 Answers

How to enable soft delete for Azure Storage blobs using PowerShell?

Chirag Nagrekar
Published on 01-Sep-2021 07:54:20
To enable soft delete for Azure Storage blobs in Storage account properties using PowerShell, we can use the Enable-AzureStorageDeleteRetentionPolicy command. From the Azure portal, we need to access the Data Protection property of the Azure Storage account.You can also provide the retention days to keep the soft-deleted data. To perform the ... Read More

How to create the Azure Storage context using PowerShell?

Chirag Nagrekar
Published on 01-Sep-2021 07:48:38
Storage context is helpful when you are working with the Storage accounts in the PowerShell session. It is like authenticating for Azure storage. Generally, we use the Azure storage account key and the connection string to create the Azure storage context.To create a new storage context, we need to use ... Read More

How to use Azure Rest API in PowerShell?

Chirag Nagrekar
Published on 01-Sep-2021 07:46:38
To use the Azure Rest API using PowerShell, we first need to connect to the Azure cloud account using the Connect-AzAccount. Once you are connected to the Azure Account, you can use the below authorization header (same has been provided on the MS website) which contains a bearer token to ... Read More

How to export output to excel in PowerShell?

Chirag Nagrekar
Published on 01-Sep-2021 07:43:23
As of now, there is no built-in command like CSV (Export-CSV) to export output to the excel file but we can use the Out-File command to export data to excel or any other file format.Let’s use Out-File to export the output of the Get-Processes command to an excel file.Get-Process | ... Read More

How to resolve - The underlying connection was closed - Could not establish trust relationship for the SSL/TLS secure channel in PowerShell?

Chirag Nagrekar
Published on 01-Sep-2021 07:40:52
When you run Invoke-WebRequest or Invoke-RestMethod command, sometimes you get the error “The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.” because there could be a certificate issue or the required windows version doesn’t support the TLS or SSL version. You can use the ... Read More

How to disable the Azure VM accelerated settings using PowerShell?

Chirag Nagrekar
Published on 31-Aug-2021 10:14:09
To disable the Azure VM accelerated settings using PowerShell, we need to disable the EnableAcceleratedNetworking property on the NIC attached to the VM.$vm = Get-AzVM -Name TestVM $nicname = (($vm.NetworkProfile.NetworkInterfaces.id).Split('/'))[-1] $nicsetting = Get-AzNetworkInterface -ResourceGroupName $vm.ResourceGroupName - Name $nicname $nicsetting.EnableAcceleratedNetworking = $falseIn the above example, we are setting AN settings on ... Read More

How to enable the Azure VM accelerated settings using PowerShell?

Chirag Nagrekar
Published on 31-Aug-2021 10:13:25
To enable the Azure VM accelerated settings using PowerShell, we need to enable the EnableAcceleratedNetworking property on the NIC attached to the VM.$vm = Get-AzVM -Name TestVM $nicname = (($vm.NetworkProfile.NetworkInterfaces.id).Split('/'))[-1] $nicsetting = Get-AzNetworkInterface -ResourceGroupName $vm.ResourceGroupName - Name $nicname $nicsetting.EnableAcceleratedNetworking = $trueIn the above example, we are setting AN settings on ... Read More

How to get the Accelerated networking status of Azure VM using PowerShell?

Chirag Nagrekar
Published on 31-Aug-2021 10:12:35
From the Azure Portal, we can find the Accelerated Networking (AN) status from the networking blade.To get the AN settings on the VM, we need to first retrieve the NIC information because it is set on it. We have the VM named ‘TestVM’ and we will retrieve its NIC information.PS ... Read More

How to enable the basic authentication for windows servers using PowerShell?

Chirag Nagrekar
Published on 31-Aug-2021 10:11:30
Basic authentication is the insecure authentication for windows. Before enabling it make sure you comply with your organization policies. To enable the basic authentication for the windows servers using PowerShell, we can use the below command.PS C:\> Set-Item -Path "WSMan:\localhost\Service\Auth\Basic" -Value $true -VerboseTo enable the basic authentication for the remote ... Read More

How to disable basic authentication for windows server using PowerShell?

Chirag Nagrekar
Published on 31-Aug-2021 10:10:47
Basic authentication is the insecure authentication for the windows. To disable the basic authentication on the windows server using PowerShell, PS C:\> Set-Item -Path "WSMan:\localhost\Service\Auth\Basic" -Value $false -VerboseTo disable the basic authentication on the remote windows servers using PowerShell, use the below command, Invoke-Command -ComputerName TestMahchine1, TestMachine2 - ScriptBlock { ... Read More
Advertisements