I did a script to ger network usage when i am not logged, based on get-counter.
It working in my session, but if I launch it with task manager in startup of the computer, the script work, it not working.
I test the following command in debug.ps1
-------------------------------------------------------
# task manager parameters
# run if user not log
# at startup
# program : powershell.exe
# argument : -noprofile -executionpolicy RemoteSigned -file C:\Users\myuser\debug.ps1
$dirlocation="C:\users\$env:USERNAME"
$debugFile="$dirlocation\debug.txt"
write-output "test get-counter" | out-file $debugFile
Get-Counter -ListSet * | out-file $debugFile -Append
write-output "end test" | out-file $debugFile -Append
-------------------------------------------------------------------
I have in debut.txt all Listset if I run script in my session
But I have the following if A start it with task manager
C:\users\MyUser > Get-Content .\debug.txt
test get-counter
end test
C:\users\MyUser>
Can someone explain how get %network used in program launch by task manager if get-counter not work ?