forked from tomtorggler/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqos.ps1
37 lines (32 loc) · 1.13 KB
/
qos.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function Get-QoSPolicy {
[CmdletBinding()]
param(
[Parameter()]
[ValidateSet("User","Computer","All")]
$Type = "Computer"
)
switch ($Type) {
'User' {
$QoSPath = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\QoS"
}
'Computer' {
$QoSPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\QoS"
}
'All' {
$QoSPath = @("HKLM:\SOFTWARE\Policies\Microsoft\Windows\QoS","HKCU:\SOFTWARE\Policies\Microsoft\Windows\QoS")
}
}
foreach($path in $QoSPath) {
$QoS = Get-Item -Path $path
Write-Verbose "Found $($Qos.SubkeyCount) Policies in $($QoS.PSDrive)."
if($QoS.SubKeyCount -ne 0){
Get-ChildItem $path | ForEach-Object {
New-Object -TypeName psobject -Property ([ordered]@{
Drive = $_.PSDrive
Name = $_.PsChildName
Properties = Get-ItemProperty -Path $_.PsPath | Select-Object -Property * -ExcludeProperty ps*
})
}
}
}
}