Chirag Nagrekar has Published 465 Articles

How to use an alias() for the parameter in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 09-Nov-2020 09:33:23

3K+ Views

PowerShell alias is a good way to use the shortcut name for the Parameter instead of writing the full name of the parameter. For example, you can refer to Server as ServerName, AppID as the ApplicationID.So you don’t have to use the whole name of the parameter and it is ... Read More

How to find a network adapter driver version using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 09-Nov-2020 09:31:58

5K+ Views

To find the network adapter driver version using PowerShell, we can use the Get-NetAdapter cmdlet. First, let look at how the network adapter driver version looks like from GUI.Get-NetAdapter will retrieve all the Physical and Virtual network adapters unless specified.This cmdlet has a property called DriverVersion, DriverDate, and DriverProvider. You ... Read More

Difference between single quote (‘) and double quote (“) in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 09-Nov-2020 06:49:46

5K+ Views

There is no such difference between the single quote (‘) and double quote(“) in PowerShell. It is similar to a programming language like Python. We generally use both quotes to print the statements.ExamplePS C:\> Write-Output 'This will be printed using Single quote' This will be printed using Single quote PS ... Read More

How to use Push-Location and Pop-Location command in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 02-Nov-2020 11:12:22

2K+ Views

Push-Location command in PowerShell is used to push (add) the current location to the location stack (Last In First Out (LIFO) - queue) while the Pop-Location is to retrieve the last location from the stack.When the PowerShell console opens there are no locations set to the stack.PS C:\> Get-Location -Stack ... Read More

How to use the Set-Location command in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 02-Nov-2020 11:07:34

2K+ Views

Set-Location command in PowerShell is used to set the location of the drive from the current directory. The drive could be the local drive, folder path, shared path, registry, or any environmental variable.This command is very useful while writing the script because many times we need multiple files from the ... Read More

What is PowerShell Desired State Configuration?

Chirag Nagrekar

Chirag Nagrekar

Updated on 02-Nov-2020 11:05:40

312 Views

Although DSC is a very large topic, we will quickly summarize it in this article with the needed concepts to what exactly it is and how we can implement it.PowerShell Desired State Configuration (DSC) is an Infrastructure automation tool and used for Infrastructure as a Code (Iaac). Besides, DSC can ... Read More

How to convert the hashtable to the JSON format using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 02-Nov-2020 11:00:16

2K+ Views

To convert the hashtable to the JSON format we can use the ConvertTo-Json command. First, we have the following hashtable, Example$Body = [PSCustomObject]@{    AppName = 'StorageXIO'    AppID ='xo2ss-12233-2nn12'    License = 'valid' }To convert the hashtable to the JSON format, $Body | ConvertTo-JsonOnce you run the above command, ... Read More

How to add help in the PowerShell function?

Chirag Nagrekar

Chirag Nagrekar

Updated on 02-Nov-2020 10:59:04

287 Views

When we write a program, people from a non-programming background often expect to get much possible help related to the program. When we write the function and we declare the parameters, people who are unaware of what kind of input the parameter need, generally search for the help first using the ... Read More

How to enable or disable local user on Windows OS using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 02-Nov-2020 10:54:29

3K+ Views

To disable the local user on the windows OS using PowerShell, we can use the Disable-Localuser command provided by the local user name. In the below example, we are going to disable the local user called TestUser.Disable-LocalUser -Name TestUserIf we see the GUI, the user account is disabled.To enable the ... Read More

How to delete the local group from the windows system using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 02-Nov-2020 10:51:41

489 Views

To delete the local group from the windows system using PowerShell, you need to use the RemoveLocalGroup command as shown below.Remove-LocalGroup -Name TestGroupIn the above example, the local group name TestGroup will be removed from the local system. To remove the local group from the remote systems, we can use Invoke-Command ... Read More

Advertisements