ProblemSuppose, we have the following code that creates a Binary Search Tree DS and provides us with the functionality to insert node −class Node{ constructor(data) { this.data = data; this.left = null; this.right = null; }; }; class BinarySearchTree{ constructor(){ // root of a binary seach tree this.root = null; } insert(data){ var newNode = new Node(data); if(this.root === null){ this.root = newNode; }else{ ... Read More
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 method, Get-InstalledModule 7Zip4Powershell | Uninstall-Module -Force -VerboseIf you have multiple versions of the same module installed in the PowerShell, and if you want to uninstall all of them then use the -AllVersions Parameter.Uninstall-Module 7Zip4PowerShell -AllVersions -Force -VerboseIf you want to uninstall the specific version, we can use -RequiredVersion.Uninstall-Module 7Zip4PowerShell -RequiredVersion ... Read More
If you are suddenly receiving random ads on your browser and system, it might be because of an Adware infection. This post will guide you on what is Adware, how do you get it, what are its symptoms, and how to protect your device from Adware.What is Adware?Adware is short for advertising-supported software. It is the extension or application responsible for ad displaying on your browser, applications, or system. Generally, Adware enters the system unintentionally, and therefore it comes under Potentially Unwanted Programs or PUP. Since it can conduct various malicious tasks after infiltrating your device, it is also one ... Read More
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 -VerboseTo manually install the latest version of the PowerShell module, there are two methods.Use the -RequiredVersion parameter if you know the latest version of the module.Use the -MinimumVersion parameter if you know the minor version of the module and it will pick up the latest version.Using -RequiredVersion ParameterThis parameter installs ... Read More
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, we will use the 7Zip4PowerShell module.ExampleFind-Module 7zip4PowerShell -AllVersions | ft -AutoSizeWhen you run this command, you can see there are multiple versions available for this module.OutputVersion Name Repository ------- ---- ---------- 1.13.0 7Zip4Powershell PSGallery 1.12.0 7Zip4Powershell PSGallery 1.11.0 ... Read More
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 # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 8.8.8.8 Google.comWe need to update the google.com entry to IP address ... Read More
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 += "8.8.8.8 Google.com" Set-Content -Path $file -Value $hostfile -ForceOnce you check the host file entry "8.8.8.8 Google.com" will be added to the host file.To add the entry on the remote computer, you just need to point that file location to the host file of the remote server and the rest of ... Read More
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 at that location.Or you can use $env:Windir to get the windows directory.To get the file content, ExampleGet-Content $env:windir\system32\drivers\etc\hostsOutput# Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 ... Read More
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 shown below and in this example, we are using the Invoke-Command to connect to another computer and from there we are checking if the shared path is accessible.ExampleInvoke-Command -ComputerName LabMachine2k16 -ScriptBlock { Test-Path -Path "\ad\Shared\Temp" }This script throws an exception.OutputAccess is denied + CategoryInfo : PermissionDenied: ... Read More
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 console will include the certificate thumbprint.For example, we are going to retrieve the certificate from the personal store.ExampleGet-ChildItem Cert:\LocalMachine\My\OutputPSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\My Thumbprint Subject ---------- ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP