- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2043 Articles for Microsoft Technologies
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
872 Views
The ConvertFrom-String command converts the String to the Hashtable format as shown below.ExamplePS C:\> "This is string" | ConvertFrom-StringOutputP1 P2 P3 -- -- -- This is stringIn the above example, We haven’t specified any header so that the output is separated the delimiter by space P1, P2 and continuous. By default, this command separates the string with a ‘=’ delimiter as shown below.Example$stringhash = @" Name = Spooler Starttype = Manual Status = Stopped "@ $stringhash | ConvertFrom-StringDataOutputName Value ---- ----- ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
3K+ Views
ExampleFor example, we have a below-created hashtable.PS C:\> $servicehash = @{Name='Spooler';State='Stopped';StartType='Automatic'} PS C:\> $servicehashOutputName Value ---- ----- Name Spooler StartType Automatic State StoppedWe need to add multiple values to the Name Key. If we directly append the value to the key it will treat it as a string and we will not get the desired output. See the example below.ExamplePS C:\> $servicehash.Name += "Winrm" PS C:\> $servicehashOutputName Value ---- ----- Name SpoolerWinrm StartType Automatic State StoppedSo to add the multiple ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
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 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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
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 -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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
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, 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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
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 # 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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
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 += "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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
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 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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
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 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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
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 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