Trying to filter results and I have no idea how...and a few other misc questions

I am trying to filter results so that I only display the lines of results that I want.

Here is an example:

I enter:

netsh wlan show networks mode=bssid

My Results:

Interface name : TP-LINK
There are 1 networks currently visible.

SSID 1 : CableWiFi
Network type : Infrastructure
Authentication : Open
Encryption : None
BSSID 1 : dx:a7:x9:xx:xa:xx
Signal : 92%
Radio type : 802.11n
Channel : 11
Basic rates (Mbps) : 60
Other rates (Mbps) : 5.5 9 11 12 18 24 36 48 54 96

<hr />

How do I add a filter to only extract the lines that I want shown?

For Example I want my results to just show the following:

SSID 1 : CableWiFi

Signal : 92%

Channel : 11

<hr />

I dont know if that is pooible or not to just show what results I want… and I need some help with other commands.

I need a command that show my current Wifi Speed (download).

If there is a command to refresh these or loop them after a 5 seconds.

Also with command prompt when I write text out it all shows on 1 line, with PS it shows a word every line…what is with that?

 

I am a total newbie at PS, I’m not even that good with a Command Prompt in all honesty and I am teaching myself. Any and all help is appreciated and if ya have some good links to teach a newbie like me that would be great, for both PS and even a command prompt. I have been having some fun writing some stuff like batch files to automatically do stuff instead of windows going here and and clicking there… I enjoy this very much and 1 day hope to be good enough to even answers a question instead of ask one… Thank You!!!

 

First of all: welcome to Powershell.org forum. You’re on the right spot. :wink:

Second: You might start with learning the very basics of Powershell first. That will save you from a lot of wasted time, misunderstandings and frustration. It will even help you to understand most of the help you will get in forums like this one.
A good and pretty entertaining start for you could be the free video course at the Microsoft Virtual Academy - Getting Started with Powershell. You should not wait too long - they will close the MVA in the near future.
If you’ve learned your first lessions you could take a closer look to the cmdlets ConvertFrom-String or ConvertFrom-StringData, Where-Object and Select-Object. Furthermore you should read the help for about_Comparison_Operators and about_If.

Olaf,

Thank you for a speedy reply. A major issue was I did not know even where to start and most explanations are for experienced users. I do like the ISE… that is great! I will go there and continue my education on this.

I’m trying to make different scripts that I have made as batch files, but command for PS are not exactly the same.

I am having issues with PS trying to show download speeds, I have searched but cant find anything that is simple to just show that. Google today removed check wifi speed as it would show right up in the search results and you could click it from there. It was simple and easy without all the Bullsh*t, so I just want to make a powershell file or a batch file to click on it and it will display my Download speed right away. I need that for one of my PC’s that uses a TP-Link adapter for connection to various wi-fi hotspots.

 

Thanks guys…

AS Olaf stated, there are some great learning opportunities!
That being said, for tasks like you defined, I tend to use ConvertFrom-String

Using your question, here is a potential solution

Have fun!

Of course they are not the same and you hsould be glad about. Powershell is made to make systems management for administrators as easy as possible. So some things are built in because they are often used and some things are a little more complex. But I think it will pay off for you in the future when you take your time to learn the foundation of Powershell first.

[quote quote=143010]First of all: welcome to Powershell.org forum. You’re on the right spot. 😉

A good and pretty entertaining start for you could be the free video course at the Microsoft Virtual Academy – Getting Started with Powershell. You should not wait too long – they will close the MVA in the near future.

[/quote]

It’s available on You Tube Now: https://www.youtube.com/playlist?list=PLyJiOytEPs4etH7Ujq7PU7jlOlHL-9RmV

I would also highly recommend ‘Powershell In A month of Lunches’

 

 

 

There are tons of examples all over the web on how to do this, including samples.

Just search for them using whatever you posted here. Example ‘PowerShell Netsh’, ‘PowerShell Selecting strings.’

I agree with the rest of the folks about getting ramped up first.
There are tons of PowerShell beginner to advanced trading videos on YouTube.

Click the ‘Free Resources’ like in the navigation pane on this site to the left and check out the books and videos there as well.

You can follow all the leads here:

And this…

https://blogs.msmvps.com/richardsiddaway/2019/02/21/the-source-of-powershell-cmdlets

As far as your issue. That is not PowerShell of course, the cmd.exe / DOS text-based stuff. PowerShell is an object-based language.

All that being said, if you what to use PowerShell, then use the PowerShell cmdlets for everything vs DOS stuff, unless you have no other choice.

As for what you are doing, PowerShell has specific cmdlets to replace that DOS command.

Replace netsh with Windows PowerShell – Basic network cmdlets

Again, as for what you are after, even using netsh, you need to look to the Select-String cmdlet or RegEx.

See the help files…

# get function / cmdlet details
(Get-Command -Name Select-String).Parameters
Get-help -Name Select-String -Full
Get-help -Name Select-String -Online
Get-help -Name Select-String -Examples

#########################
Example 1: Find a case-sensitive match
PS C:\>"Hello","HELLO" | Select-String -Pattern "HELLO" -CaseSensitive
    

Example 2: Find matches in XML files only 
PS C:\>Select-String -Path "*.xml" -Pattern "the the"
    

Example 3: Find a pattern match  
PS C:\>Select-String -Path "$pshome\en-US\*.txt" -Pattern "@"
    

Example 4: Use Select-String in a function 
PS C:\>function search-help
{
    $pshelp = "$pshome\es\about_*.txt", "$pshome\en-US\*dll-help.xml"
    Select-String -path $pshelp -Pattern $args[0]
}
   
    
Example 5: Search for a string in the Application log
PS C:\>$Events = Get-EventLog -LogName application -Newest 100
PS C:\>$Events | Select-String -InputObject {$_.message} -Pattern "failed"
    

Example 6: Find a string in subdirectories  
PS C:\>Get-ChildItem c:\windows\system32\*.txt -Recurse | Select-String -Pattern "Microsoft" -CaseSensitive

    
PS C:\>Select-String -Path "process.txt" -Pattern "idle, svchost" -NotMatch
    

Example 8: Find lines before and after a match
PS C:\>$F = Select-String -Path "audit.log" -Pattern "logon failed" -Context 2, 3
PS C:\>$F.count
PS C:\>($F)[0].context | Format-List
    

Example 9: Find all pattern matches
PS C:\>$A = Get-ChildItem $pshome\en-us\about*.help.txt | Select-String -Pattern "transcript"
PS C:\>$B = Get-ChildItem $pshome\en-us\about*.help.txt | Select-String -Pattern "transcript" -AllMatches
#########################


What you are doing... But again, use the PowerShell cmdlets first. Avoid DOS whenever possible.
netsh wlan show networks mode=bssid | Select-String -Pattern 'SSID|Signal|Channel'

Just wanted to say thank you guys… Helped me a lot!!!

I have a question off the subject of PS…

Trying to do something it is driving me mad…

Anyone know how to view a page offline that runs java scripts and connects to a server… I have a program that can even download the site and I can’t figure out how to run the page OFFLINE…

the website is www.fast.com it shows internet speed… I cant get the page to run offline no matter what the hell I do… Ive searched an the only answer I got w/ Chrome was to change a flag setting which I have done… I think I have to change the HTML in the page to get it run… if anyone know how to make that page run when save as a local copy let me know… The page will load but when it goes to run I get * Could not reach our servers to perform the test. You may not be connected to the internet… wanna use this later to tie it into something…

Thanks

 

 

If you have a new question you should create a new thread. And you’re on the wrong forum for that question. You should ask in a Chrome based forum. If the page you’re trying to “run” offline needs server based tasks you’re pretty much out of luck when you don’t have webserver.
You might start with searching the appropriate forum for your question.
Here it is about Powershell scripts.
If you’re looking for prewritten scripts or modules you could try PowershellGallery.

Maybe something like this: https://www.powershellgallery.com/packages/SpeedTester/1.2.0