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

PowerShellMicrosoft TechnologiesSoftware & Coding

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.

Example

For example, below command will provide you system files and folders under C:\Windows\System32.

PS C:\WINDOWS\system32> Get-ChildItem -System

Output

Directory: C:\WINDOWS\system32
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d---s-       25-12-2019     01:14                AppV
d---s-       19-03-2019     10:22                Configuration
d---s-       23-12-2019     02:45                DiagSvcs
d---s-       19-03-2019     11:50                dsc
d---s-       19-03-2019     11:50                F12
d---s-       19-03-2019     10:23                Nui
d---s-       19-03-2019     10:23                UNP

Command

You can also combine multiple parameters. For example, to get the system files which are readonly use command,

PS C:\WINDOWS\system32> Get-ChildItem –System –ReadOnly -Recurse

Output

Directory: C:\WINDOWS\system32\restore
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-ar-s-       24-12-2019     23:40             76 MachineGuid.txt

Command

To get the system files that are hidden.

PS C:\WINDOWS\system32> Get-ChildItem –System –Hidden -Recurse

Output

Directory: C:\WINDOWS\system32\SMI\Store\Machine
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a-hs-       19-03-2019     10:07              0 SCHEMA.DAT.LOG1
-a-hs-       19-03-2019     10:07           8192 SCHEMA.DAT.LOG2
-a-hs-       25-12-2019     01:16          65536 SCHEMA.DAT{fd9a35e3-49fe-11e9-aa2c-248a07783950}.TM.blf
-a-hs-       25-12-2019     01:16         524288 SCHEMA.DAT{fd9a35e3-49fe-11e9-aa2c-248a07783950}.TMContainer0000000000
                                                 0000000001.regtrans-ms
-a-hs-       19-03-2019     13:11         524288 SCHEMA.DAT{fd9a35e3-49fe-11e9-aa2c-248a07783950}.TMContainer0000000000
                                                 0000000002.regtrans-ms
raja
Published on 23-Jan-2020 07:54:19
Advertisements