Chirag Nagrekar has Published 468 Answers

How to check the properties of the Windows PowerShell Console?

Chirag Nagrekar

Chirag Nagrekar

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

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

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

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            asRead More

How to get the system files using the Get-ChildItem in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

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

System files are operating system files and are not visible by default using Get-ChildItem. To get the system files you need to use –System parameter.ExampleFor example, below command will provide you system files and folders under C:\Windows\System32.PS C:\WINDOWS\system32> Get-ChildItem -SystemOutputDirectory: C:\WINDOWS\system32 Mode                LastWriteTime ... Read More

How to get the readonly files using Get-ChildItem in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 07:53:04

To get the Readonly files with Get-ChildItem in PowerShell, you need to use the –Readonly files. Readonly file has attribute ‘r’.In the below example, you can check the attribute of the file.Get-ChildItem D:\Temp\ -ReadOnlyOutputPS C:\WINDOWS\system32> Get-ChildItem D:\Temp\* -ReadOnly     Directory: D:\Temp Mode               ... Read More

How to exclude specific file names using Get-ChildItem in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 07:52:30

To exclude specific file(s) from being displayed in the output of Get- ChildItem, you need to specify the file name(s).CommandGet-ChildItem D:\Temp\ -Recurse -Exclude style.css, LGPO.exeOutputDirectory: D:\Temp\LGPO Mode                LastWriteTime         Length Name ----                ------------- ... Read More

How to exclude specific extension in Get-ChildItem in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 07:49:27

To exclude specific extensions, you need to use –Exclude parameter in Get-ChildItem.ExampleFor example, as shown below when we run command, it will exclude .html files and display the rest.Get-ChildItem D:\Temp\ -Recurse -Exclude *.htmlOutputDirectory: D:\Temp Mode                LastWriteTime         Length Name ---- ... Read More

How to search for files using the wildcard character (*) in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 07:48:25

You can also search for files with a specific name or using the wildcard (*) character.CommandBelow command will search for the files (including hidden files) starting with “Bac”.Get-ChildItem D:\Temp -Recurse -Force -Include Bac*OutputPS C:\WINDOWS\system32> Get-ChildItem D:\Temp -Recurse -Force -Include Bac*     Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} Mode           ... Read More

How to use the wildcard character (*) in Get-ChildItem in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 07:47:45

You can also search for files with a specific name or using the wildcard (*) character.CommandBelow command will search for the files (including hidden files) starting with “Bac”.Get-ChildItem D:\Temp -Recurse -Force -Include Bac*OutputPS C:\WINDOWS\system32> Get-ChildItem D:\Temp -Recurse -Force -Include Bac*     Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} Mode           ... Read More

How to search for a specific extension using Get-ChildItem in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 07:47:07

To get the output of the get-childitem with a specific extension, we need to use –includeparameter.ExampleIn the below example, we will use the below script to get only .xml files.Get-ChildItem D:\Temp\ -Recurse -Include *.xmlOutputPS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Recurse -Include *.xml     Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} Mode           ... Read More

Advertisements