- 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
Chirag Nagrekar has Published 465 Articles
Chirag Nagrekar
10K+ Views
To create a dictionary in the PowerShell we need to use the class Dictionary from the .Net namespace System.Collections.Generic. It has TKey and TValue. Its basic syntax isDictionaryTo learn more about this .Net namespace check the link below.https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2?view=net-5.0To create a dictionary we will first create the object for the dictionary object ... Read More
Chirag Nagrekar
20K+ Views
To convert the JSON file to the CSV file using PowerShell, we need to use the ConvertTo-CSV command as a pipeline.For example, we have a JSON file called PatchingServer.JSON stored at C:\temp and its content is as below.ExamplePS C:\> Get-Content C:\Temp\PatchingServer.json { "Port": "9000", "ApplicationName": "TestApp", "MaintenanceWindow": "Every ... Read More
Chirag Nagrekar
4K+ Views
Windows Product key can be retrieved using PowerShell or CMD. To retrieve the product key using PowerShell, we need to query SoftwareLicesingService class and there is a property called OA3xOriginalProductKey which stores the product key.ExampleGet-WmiObject -query `select * from SoftwareLicensingService' | Select OA3xOriginalProductKeyOutputOA3xOriginalProductKey ---------------------- BBBBB-CSDSC-EESSR-KKIDS-AAAAAWe can also query this WMI class ... Read More
Chirag Nagrekar
4K+ Views
Generally, Product serial numbers are available at the back of the laptop on the company sticker and we can use the Third-party or manufacturer software to find the Product details. The product serial number can also be found using the BIOS utility or command. We can either use the BIOS ... Read More
Chirag Nagrekar
486 Views
To set the line breakpoint in the script, we can use the Set-PSBreakpoint command with -Line parameter and need to give the path of the script on which the Line breakpoint needs to set.Consider we have the script below which retrieves the value up to 99, starting from 1, We ... Read More
Chirag Nagrekar
214 Views
Breakpoint in the PowerShell is the part of the debugger in the PowerShell commands. We use the breakpoints in PowerShell mainly for troubleshooting and logging purpose.There are three ways to set the breakpoint in PowerShell.Line BreakPoint (Can set the breakpoint for single or multiple lines)Command BreakPoint (Can set the breakpoint ... Read More
Chirag Nagrekar
6K+ Views
To check if the file is empty using PowerShell, we can use the string method called IsNullorWhiteSpace(). This method provides result true if the file is empty or only contains the white spaces otherwise false.For example, We have a test2.txt text file which has whitespaces.Example[String]::IsNullOrWhiteSpace((Get-content C:\Test2.txt))OutputTrueBut if you have a ... Read More
Chirag Nagrekar
2K+ Views
To open any file using its default application, we can use the Invoke-Expression command. For example, we want to open a file on the C:\temp and the file name is NewUsers.CSV then you can run the below command.Invoke-Expression C:\Temp\NewUsers.csvThe above command will open the file from that location. If the ... Read More
Chirag Nagrekar
864 Views
We have a raw text example and to convert it into the CSV values, we can use below code.ExamplePS C:\> $text = "This is a PowerShell latest version" PS C:\> $text.Replace(' ', ', ')OutputThis, is, a, PowerShell, latest, versionIf there are multiple spaces between the keywords then the above replace ... Read More
Chirag Nagrekar
3K+ Views
We can get the list of opened applications in Windows using PowerShell using Get-Process command. Get-Process command shows the currently running processes in the foreground and the background as well.If we simply run the Get-Process command then it will give the process names and their associated process IDs and CPU, ... Read More