0

I have this code and it works but it makes a domain GPO policy and not a local one. How do i get it to make it local?

#Create QOS for RDP Session
#Create a new Group Policy Object (GPO) that will be applied to the LocalHost that contain the computer objects.
#The value "Teams client - QoS" can be modified to fit your needs or naming standards
New-GPO "Local Computer Policy"  -Name "MSTSC" -Comment "QoS for Agents."

#Create Registry Value for Teams client Audio QoS in the "Teams Client - QoS" GPO
Set-GPRegistryValue -Name "MSTSC" -Key "HKLM\SOFTWARE\Policies\Microsoft\Windows\QoS\MSTSC" -ValueName "Application Name", "DSCP Value", "Local IP", "Local IP Prefix Length", "Local Port", "Protocol", "Remote IP", "Remote IP Prefix Length", "Remote Port", "Throttle Rate", Version -Type String -Value "mstsc.exe", "0", "*", "*", "*", "*", "*", "*", "*", "-1", "1.0"
1

As for this..

'makes a domain GPO policy and not a local one'

this is by design. There are no cmdlets for local GPO native in PowerShell so, either you have to write this yourself, or use this module

PolicyFileEditor:

See this article on it's use: How to manage Local Group Policy with Powershell

This module can be used to manage your local policies, but it can also be used to get the policies from Policy templates. An example would be the policy templates shipped with Security Compliance Manager. If you also want to set a baseline for your Local policies, you can use this module to compare your live policies to the ones in the templates. It is then very easy to go back and make a single change if a policy changes. In the screenshot below you can see the output of Get-PolicyFileEntry for a SCM Windows 10 User Policy.

  • That is a good article but i tried it and it didn't work for me. See this article on it's use: How to manage Local Group Policy with Powershell – James Jan 9 at 14:34
0

I wasn't able to put it in GPO but i was able to add it to the Registry

# Setup QOS on MSTSC session

# Works but doesn't show up in GPO Editor
#reg import .\MSTSC.reg

# Works but doesn't show up in GPO Editor
# Invoke-Command {reg import .\MSTSC.reg *>&1}

# Works but doesn't show up in GPO Editor
$StartParams = @{
FilePath = "$Env:SystemRoot\REGEDIT.exe"
ArgumentList = '/s','.\MSTSC.reg'
Verb = 'RunAs'
PassThru = $True
Wait = $True
}
$Proc = Start-Process @StartParams

If ($Proc.ExitCode -eq 0) { Write-Host 'Success!' }
Else { Write-Host "Fail! Exit code: $($Proc.ExitCode)" }

Pause

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.