Package Information
Get-AppxPackage > AppDetails.txt
Change Owner
Using CLI
To use takeown
the user has to have “Take Ownership” permission.
# Change Owner to current user
takeown /f "C:\Program Files\WindowsApps" /r
# Change Owner to a different user
icacls "C:\Program Files\WindowsApps" /setowner "DOM\user" /t /l
Using GUI
Right-click Folder → Properties → Security → Advanced
Use the Change button beside the Owner
Enter the name of the user and click on Check Name
Permissions
View Permissions
icacls
: Identity Control Access Control List(s)
icacls "C:\Users"
Code | Permission |
---|---|
F | Full Control |
M | Modify |
RX | Read & Execute |
R | Read |
W | Write |
By default the permissions are inherited by the children objects
Code | Name | Description |
---|---|---|
I | Inheritance | Permission received from parent |
OI | Object Inheritance | File will inherit permissions |
CI | Container Inheritance | Folder will inherit permissions |
Change Permissions
icacls C:\foo /grant "DOM\user:(OI)(CI)(F)"
icacls C:\foo /grant "DOM\user:(OI)(CI)(R,WO)"
/remove
can be used to remove permission
Attributes
View Attributes
# List all objects (including Hidden)
Get-ChildItem "C:\path\to\folder" -Force
# Object Attributes
Get-Item "C:\path\to\file" | Format-List Attributes
(Get-Item "C:\path\to\file").Attributes
-Hidden
: List hidden objects only
Character | Meaning |
---|---|
d | Directory |
a | Archive (file is flagged for backup or archiving) |
r | Read-only (cannot be modified easily) |
h | Hidden (not shown in Explorer by default) |
s | System (used by the OS, often protected) |
All normal files will have the a
flag set. All objects have at least one attribute.
The s
flag will make a file protected, the file will be hidden in Explorer.
Change Attributes
# Add attributes
Set-ItemProperty -Path "C:\path\to\file" `
-Name Attributes -Value "Hidden, ReadOnly"
# Reset attributes
Set-ItemProperty -Path "C:\path\to\file" -Name Attributes -Value Normal
# Remove Attributes
(Get-Item "C:\path\to\file").Attributes -= "Hidden, System"
Attribute | Description |
---|---|
ReadOnly | Prevents a file from being modified. |
Hidden | Hides the file from standard directory listings. |
System | Marks the file as a system file, used by the OS. |
Archive | Indicates the file has been modified since the last backup. |
Normal | Reset object attributes. |
FileAttributes Enum (System.IO) | Microsoft Learn
# Works with CMD
attrib +h "C:\path\to\file.ico"
attrib -h -s "C:\path\to\file.ico"