N
N
NikanorovKir2021-05-14 21:31:51
Windows
NikanorovKir, 2021-05-14 21:31:51

How to put a dcsp-tag on application traffic in home editions of Windows?

Good day.

OS version Windows 10 Home for one language 1909 (build 1863.1198)

1) Add a QoS rule with the cmdlet

New-NetQosPolicy -name "dscp_skype" -NetworkProfile all -DSCPAction 32 -AppPathName skype.exe -IPProtocol Both

Check:

PS C:\WINDOWS\system32 > Get-NetQosPolicy



Name : dscp_skype

Owner : Group Policy (Machine)

NetworkProfile : All

Precedence : 127

AppPathName : skype.exe

JobObject :

IPProtocol : Both

DSCPValue : 32

But traffic from the application is not marked. I set up exactly the same on the Prof editions (not in the domain) and the marking works!

I check that in the "home" edition in C:\Windows\System32\GroupPolicy\Machine\Registry.pol the same entries are added as in prof: 

Software\Policies\Microsoft\Windows\QoS\dscp_skype,Version,REG_SZ,"2.0"

Software\Policies\Microsoft\Windows\QoS\dscp_skype,NetProfile,REG_DWORD,"00000007"

Software\Policies\Microsoft\Windows\QoS\dscp_skype,Precedence,REG_DWORD,"0000007f"

Software\Policies\Microsoft\Windows\QoS\dscp_skype, AppName,REG_SZ,"skype.exe"

Software\Policies\Microsoft\Windows\QoS\dscp_skype,Protocol,REG_DWORD,"00000003"

Software\Policies\Microsoft\Windows\QoS\dscp_skype,DSCP,REG_DWORD,"00000020"

2) I add in "home"I add the rule to the ActiveStore storage with the cmdlet:

New-NetQosPolicy -name "dscp_skype" -NetworkProfile all -DSCPAction 32 -AppPathName skype.exe -IPProtocol Both -PolicyStore "ActiveStore"

And the marking works!

Apparently, the matter is in the GPO repository, but as far as I understand, even in the home edition LGPO is supported.

Actually, the question is, how can I still force the traffic to be marked?)

You can, of course, make a task to add a rule to the ActiveStore when starting the PC, but this is very inconvenient to set up. 

For some other cmdlets, you can set the -PolicyStore parameter to PersistentStore, but New-NetQosPolicy doesn't support it. Perhaps there is another way to save the rules with this cmdlet to "permanent" storage?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NikanorovKir, 2021-08-23
@NikanorovKir

Off. the answer from MS is no way, use prof editions.
I sketched a script that creates a task in the scheduler and adds marking when the system starts:

Script

Write-Host "Введите имя пользователя для задачи в планировщике:"
$UserName = Read-Host
Write-Host "Введите пароль пользователя для задачи в планировщике:"
$UserPassword = Read-Host
function CreateUser
{
$SecUserPassword = ConvertTo-SecureString($UserPassword) -AsPlainText -Force
New-LocalUser -Name $UserName -Password $SecUserPassword -PasswordNeverExpires
Add-LocalGroupMember -Group "Администраторы" -Member $UserName
}
function CreateScheduledJob
{
Write-Host "Введите имя задания (не используйте пробелы):"
$JobName = Read-Host
Write-Host "Введите имя процесса, трафик которого нужно маркировать (так, как он отображается в диспетчере задач, например, skype.exe):"
$AppPathName = Read-Host
Write-Host "Введите значение метки DSСP (0-63):"
$DSCPAction = Read-Host
$Trigger = New-ScheduledTaskTrigger -AtStartup
$Command = "New-NetQosPolicy -name $AppPathName -NetworkProfile all -DSCPAction $DSCPAction -AppPathName $AppPathName -IPProtocol Both -PolicyStore ActiveStore"
$Argument = "-command `"$Command`""
$Action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument $Argument
Register-ScheduledTask -TaskName $JobName -Trigger $Trigger -User $UserName -Password $UserPassword -Action $Action -RunLevel Highest -Force
}
do
{
Write-Host "Создать пользователя (Y/N)?"
$CreateUserYesNo = Read-Host
} until (($CreateUserYesNo -eq "y") -or ($CreateUserYesNo -eq "n"))
if($CreateUserYesNo -eq "y")
{
CreateUser
}
CreateScheduledJob

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question