- $netsh = 'C:\Windows\System32\netsh.exe'
- $netshSwitches = "trace start capture=yes persistent=yes scenario=netconnection maxsize=400MB tracefile=MACHINE_NET_TRACE.ETL"
- Start-Process $netsh -ArgumentList $netshSwitches
Newbie needs command line tool assistance
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Newbie needs command line tool assistance
As part of a larger script, I am attempting to use NETSH to do some packet capture. Though I can get the command to run successfully from the command line, Powersehll ISE, and Console, the command absolutely refuses to run from within Powershell Studio (unless I specify it be run from console) and fails from within an EXE.
Can anyone tell me what I need to do in order to get the command to run correctly?
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Newbie needs command line tool assistance
Can you define 'fail'. What error message are you getting?
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Newbie needs command line tool assistance
That is just it; I receive no errors but the ETL file fails to be created. If the same command is run within the Powershell ISE, on the same machine, the ETL file is created and the process runs until the "netsh trace stop" command is issued.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Newbie needs command line tool assistance
Two potential problems.
1. Permisssions. ISE and console run elevated by default. You can try packaging with a manifest that requires elevation.
2. Bit level. C:\Windows\System32 is a mapped folder. If you package as a 32 bit app, it wont work on a 64 bit machine.
You can press the elevate button in Powershell studio and see if that makes a difference. Ensure that you have selected the proper platform in the platform selector.
1. Permisssions. ISE and console run elevated by default. You can try packaging with a manifest that requires elevation.
2. Bit level. C:\Windows\System32 is a mapped folder. If you package as a 32 bit app, it wont work on a 64 bit machine.
You can press the elevate button in Powershell studio and see if that makes a difference. Ensure that you have selected the proper platform in the platform selector.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.