Chirag Nagrekar has Published 465 Articles

How to overwrite or remove PowerShell alias?

Chirag Nagrekar

Chirag Nagrekar

Updated on 14-Feb-2020 07:58:30

4K+ Views

You can overwrite the Powershell alias by redefining it. For example, if the alias is created Edit for Notepad.exe and if you want to overwrite it with another program, say wordpad.exe then use the below command.We will overwrite the Edit alias cmdlet with Wordpad.exe using the Set-Alias command. When you ... Read More

How to create an array in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 14-Feb-2020 06:41:14

1K+ Views

To create or declare an array in PowerShell, there are few methods.You can directly assign values to the variable and separate it by comma (, ) and that variable becomes the variable.For example, $a = "Apple", "Dog", "Cat", "Banana", "Camel"$a is now an array. To access the variable you can ... Read More

What is Array in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 14-Feb-2020 06:40:16

243 Views

An array is consists of a set of elements of the same data types or the different data types. When the output consists of more than one line then output or stored variable automatically becomes the Array. Its data type is Object[] or ArrayList and base type would be System.array ... Read More

How to change the size of the Console using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 08:05:01

1K+ Views

You can change the size of the PowerShell Console with GUI and CLI both.With GUI −With CLI −To change the Width of the console,$host.UI.RawUI.WindowSize.Width = 150To change the Height of the console,$host.UI.RawUI.WindowSize.Height = 60

How to change the Foreground color or Font color of the console using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 08:03:21

7K+ Views

Font color is termed as the Foreground color in the PowerShell. To change the font color you can use the console GUI property “Screen Text”. There are various 16 colors available and you can change RGB properties as well.CommandTo change the color with the script, use the below command.$Host.UI.RawUI.ForegroundColor = ... Read More

How to get only folders but not the files in the Get-ChildItem in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 08:02:54

1K+ Views

To get only folders excluding files, we need to use –Attribute parameter with Directory attribute.CommandGet-ChildItem D:\Temp\ -Attributes DirectoryOutputDirectory: D:\Temp Mode                LastWriteTime         Length Name ----                -------------         ------ ---- d----- ... Read More

How to change the Title of the console using PowerShell command?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 08:02:29

5K+ Views

For various reasons, you need to change the title of the PowerShell console. Like the title to describe the script. For example, System Information or Service Information.To change the PowerShell Console Title use the “WindowsTitle” property in RawUI. It is just a temporary change. When you close the console and ... Read More

How to check the properties of the Windows PowerShell Console?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 08:01:45

627 Views

You can check the Powershell console properties in two ways. The first method is by right-clicking on the title bar and open the properties.For Example, CommandYou can find various properties there. Like Windows Size, Cursor size, Font Size, font colors, etc. But you can dynamically change the properties when the ... Read More

How to get only files but not the folders with Get-ChildItem using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 08:00:41

7K+ Views

To get only files, you need to use NOT operator in Directory attribute parameter.ExampleGet-ChildItem D:\Temp\ -Attributes !DirectoryOutputirectory: D:\Temp Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -a----   ... Read More

Which attribute parameters are supported in Get-ChildItem in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 07:54:55

201 Views

Below attribute parameters are supported in Get-ChildItem in PowerShell.Get-ChildItem Alias Reference: --------------------------------- Get-ChildItem     dir Directory         d, ad File              af Hidden            h, ah ReadOnly          ar System            as

Advertisements