You are not logged in.
Pages: 1
In PS context it works fine:
PS C:\> Set-NetConnectionProfile -InterfaceAlias "Ethernet 2" -NetworkCategory private
Same thing fails when invoked in this way:
C:\>powershell Set-NetConnectionProfile -InterfaceAlias "Ethernet 2" -NetworkCategory private
The error message is:
A positional parameter cannot be found that accepts argument '2'
Offline
Thats because you are running it from a CMD shell, so you need to take into account the CMD shell's ancient and arcane handling of quotes.
This page has some examples:
https://ss64.com/nt/syntax-run.html
By tripling the quotes, I think what's happening is that CMD parses that as a quote delimited string containing just a quote mark, so it strips the outer quotes and passes the one remaining quote through to PowerShell.
So
"""Ethernet 2"""
is seen by CMD as three strings, the first string is one quoted quote mark, the second string is the verbatim text and the third string is the last quoted quote mark.
That may not be actually how it works internally, but it's how I think of it to make sense of/remember the syntax.
Offline
Pages: 1