Answer the question
In order to leave comments, you need to log in
How in PowerShell to make the result of netsh wlan show hostednetwork written to a file when the number of clients > 0?
There is a script (my first script)
do
{
netsh wlan show hostednetwork | Out-File D:\test.txt -append
date | Out-File D:\test.txt -append
Start-Sleep -Seconds 15
}while(1)
Answer the question
In order to leave comments, you need to log in
while ($true) {
$output = netsh wlan show hostednetwork
[int]$count = ($output | sls 'Number of clients').ToString().split(':')[1]
if ($count -gt 0) {
date | Out-File D:\test.txt -append
}
Start-Sleep -Seconds 15
}
Use a pipeline.https://ru.wikipedia.org/wiki/Windows_PowerShell
some data | your condition, check for number of records | save to log
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question