Skip to content
Tech Shizz Logo

An Engineers Blog

  • TechShizz
  • blog

PowerShell | Modifying Item Properties

Posted on February 23, 2021 By rich No Comments on PowerShell | Modifying Item Properties

In this example i’ll use PowerShell to change the property of a file on the file system. I’ve created a text file called “test” in my Documents folder and launched PowerShell. 

To see the file properties I can do this:

cd $home

cd Documents

Get-ItemProperty -Path .test.txt | select *

This displays the full list of attributes for the file. In this example I’ll set the file as “read only”.

Set-ItemProperty -Path .test.txt -Name IsReadOnly $true

We can test to see if this worked by repeating the first cmdlet.

Get-ItemProperty -Path .test.txt | select *

This can be repeated on any PSDrive such as HKCU & HKCM, Active Directory.

cd HKCU:

cd SoftwareMicrosoftWindowsCurrentVersionExplorer

If we do a ‘dir’ here we can see all of the item properties within the Advanced container. This shows all of the properties within. We can see the HideFileExt property is 1. We’ll change this to 0 like this:

Set-ItemProperty -Path .Advanced -Name HideFileExt -Value 0

As you can see if we run another dir, it’s changed. We can further verify by logging of and on again and we should now see that file extensions are displayed by default in the GUI. 

Post navigation

❮ Previous Post: Reporting Mailbox Folder Sizes with PowerShell
Next Post: Deploying Office via Group Policy ❯

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Subscribe to our newsletter!

Recent Posts

  • How to Safely Use Public Wi-Fi without Compromising Your Security
  • How to implement a lightning-fast ransomware playbook
  • How to achieve defence in depth in your business
  • How to implement a SecOps team phishing response plan
  • How to block an Office 365 Sign-in correctly

Recent Comments

    Archives

    • July 2023
    • November 2022
    • July 2021
    • March 2021
    • February 2021

    Categories

    • Cyber Security
    • Uncategorized

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

    Copyright © 2023 .

    Theme: Oceanly News Dark by ScriptsTown