Chirag Nagrekar has Published 465 Articles

How to take the backup of environment variables using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 30-Mar-2021 12:53:56

931 Views

Sometimes changes in the Windows environment variable can be deadly because it saves information about user profiles, application information, and OS information. It is always better to keep the Environment backup handy and update that file whenever there are any changes or at the regular interval.Taking up the environment variables ... Read More

How to uninstall the PowerShell Module?

Chirag Nagrekar

Chirag Nagrekar

Updated on 18-Mar-2021 07:54:23

17K+ Views

To uninstall the PowerShell module, we can directly use the Uninstall-Module command but the module should not be in use, otherwise, it will throw an error.When we use the Uninstall-Module command, it can uninstall the module from the current user profile or from the all users profile.Uninstall-Module 7Zip4PowerShell -Force -VerboseAnother ... Read More

How to install the latest PowerShell module version?

Chirag Nagrekar

Chirag Nagrekar

Updated on 18-Mar-2021 07:50:56

1K+ Views

Although simply running Install-Module command picks up the latest version of the module, we can still use the -RequiredVersion and -MinimumVersion parameter to install the latest version manually. Below command directly installs the latest available version of the module.In this example we are using 7Zip4PowerShell module.Install-Module 7Zip4PowerShell -Scope AllUsers -Force ... Read More

How to install the specific version of the PowerShell module version?

Chirag Nagrekar

Chirag Nagrekar

Updated on 18-Mar-2021 07:50:01

5K+ Views

To install the specific version of the PowerShell module, we need to use the -RequiredVersion parameter with the Install-Module command.To find which module versions are available, we can use the Find-Module command with the -AllVersions parameter which retrieves all the versions of the module available in the PSGallery.In this example, ... Read More

How to update the windows host file entry using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 18-Mar-2021 07:49:12

3K+ Views

Let say you want to update the host file particular entry, we have the below host file in our local computer.ExampleGet-Content $env:windir\system32\drivers\etc\hostsOutput# For example: # #      102.54.94.97     rhino.acme.com          # source server #       38.25.63.10     x.acme.com       ... Read More

How to add the entry in the windows host file using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 18-Mar-2021 07:46:18

8K+ Views

To add the content to the host file, we need to first retrieve the content using the Get-Content command and the need to set the content to the host file after adding the entry. The Code is shown below. We need to add the global entry to it.Example$file = "C:\Windows\System32\drivers\etc\hosts" $hostfile = Get-Content $file $hostfile += ... Read More

How to read the windows host file using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 18-Mar-2021 07:45:09

2K+ Views

Windows Host file that maps the hostname and the IP address is the plain text file. So reading the host file is simpler. We just need to use the Get-Content command to retrieve the file content.Generally, the host file is stored at the location c:\windows\System32\drivers\etc\.  If the OS is installed ... Read More

How to test the shared location path from the remote computer in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 18-Mar-2021 07:43:29

2K+ Views

Many times we need to test the NAS path or shared path location from the remote server. Meaning we need to check if the shared path is accessible from the remote location and we use the Test-Path that time but we get an error of PermissionDenied or UnauthorizedAccessExcept.Our sample code is ... Read More

How to retrieve certificate thumbprint using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 18-Mar-2021 07:39:17

11K+ Views

A certificate thumbprint is a hash or signature of the thumbprint and it plays a crucial role in the security aspect. To get the certificate thumbprint using PowerShell is very much easy.We just need to retrieve the path where certificates reside and the default property that is shown on the ... Read More

How to get the certificate's start and expiry date using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 18-Mar-2021 07:38:44

1K+ Views

To get the certificate's start and expiry date using PowerShell, we first need to retrieve the certificate details using a thumbprint or other properties like friendly name, subject name, etc.Let say we have a certificate thumbprint details. So we can use the below command to retrieve the certificate's Start and ... Read More

Advertisements