- 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 463 Articles for PowerShell
1K+ Views
When –Depth parameter is used along with Get-ChildItem, it controls the recursion of displaying the subfolders and their contents. For example, if –Depth parameter is set to 1 then it will display only the content of the parent folder and immediate subfolders but not the subfolders of the subfolders.CommandWhen you specify –Depth parameter, no need to add –Recursion parameter. It will automatically set the depth level.Get-ChildItem D:\Temp\ -Depth 1OutputPS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Depth 1 Directory: D:\Temp Mode LastWriteTime Length Name ---- ... Read More
849 Views
To display the contents of the subfolders including files and folders, -Recurse parameter is used.CommandGet-ChildItem -Path D:\Temp -Recurse-Recurse parameter will not display the hidden files and folders.OutputDirectory: D:\Temp Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 13-12-2019 09:52 GPO_backup d----- 24-11-2018 11:31 LGPO -a---- 07-05-2018 23:00 ... Read More
5K+ Views
To display the contents of the subfolders including files and folders, -Recurse parameter is used.CommandGet-ChildItem -Path D:\Temp -Recurse-Recurse parameter will not display the hidden files and folders.OutputDirectory: D:\Temp Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 13-12-2019 09:52 GPO_backup d----- 24-11-2018 11:31 LGPO -a---- 07-05-2018 23:00 ... Read More
29K+ Views
To display the directory content, Get-ChildItem cmdlet is used. You need to provide the path of the directory or if you are in the same directory, you need to use only Get-ChildItem directly. In the below example, we need to display the contents of the D:\temp directory.When Get-ChildItem command is run outside of this directory then the path of the directory should be provided. This is called the absolute path.PS C:\> Get-ChildItem D:\Temp\CommandWhen this command is run directly within the directory then simply run this command. This is called a relative path.PS D:\Temp> Get-ChildItem OutputDirectory: D:\Temp Mode ... Read More
2K+ Views
When the item (file) path is provided to the Get-ChildItem cmdlet, it extracts the file information like Name, LastWriteTime, Size, etc.ExampleGet-ChildItem -Path D:\Temp\style.cssOutputDirectory: D:\Temp Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 08-12-2017 10:16 393 style.cssCommandTo get the full properties of the file then you need to use fl * (Format-List *) pipeline command.Get-ChildItem -Path D:\Temp\style.css | fl * OutputPSPath : Microsoft.PowerShell.Core\FileSystem::D:\Temp\style.css ... Read More
305 Views
There are methods or functions which are useful for directories and file operations.Methods for the directory.TypeName: System.IO.DirectoryInfo Name MemberType ---- ---------- Create Method CreateObjRef Method CreateSubdirectory Method Delete Method EnumerateDirectories Method EnumerateFiles Method EnumerateFileSystemInfos Method Equals Method ... Read More
3K+ Views
When you pipeline the parameter Get-Member (alias gm) and filter out properties then there will be two different properties that will be displayed. One is for the File and another is for the Folders.Get-ChildItem propertiesCommandGet-ChildItem | gm | where{$_.Membertype -eq "Property"}Output** Properties of Directory TypeName: System.IO.DirectoryInfo Name MemberType Definition ---- ---------- ---------- Attributes Property System.IO.FileAttributes Attributes {get;set;} CreationTime Property datetime CreationTime {get;set;} CreationTimeUtc Property datetime CreationTimeUtc {get;set;} Exists Property bool Exists {get;} Extension ... Read More
807 Views
Get-ChildItem (alias: dir) in Powershell is used to get the items inside the container. This container could be the Folders, Registry or the certificate store. You can retrieve items from one or more specified locations. This command works similar to the dir in command prompt but PowerShell provides a modern way to extract the data.
650 Views
After killing the process using Stop-Process command in PowerShell, you can determine if the process is really terminated from the system with HasExited function.For example, we will kill Notepad process and check if Notepad process still exists in the system?$notepad = Get-Process notepad | Stop-Process if($notepad.HasExited){"Process is terminated"} else{"Process is still running"}