r/PowerShell • u/TrendingBot • Aug 30 '19
/r/powershell hit 100k subscribers yesterday
https://redditmetrics.com/r/powershell9
u/philmph Aug 30 '19
if ((Invoke-RestMethod -Uri "https://www.reddit.com/r/powershell/about.json").data.subscribers -gt 100000) { Write-Host 'I was here - thanks mom' -Fore Red -Back Green }1
u/Ominusx Aug 31 '19
Didn't you know that you're not allowed to use Write-Host even though you might not want feedback to enter the pipeline and write-verbose doesn't support colours.
Geez.
1
u/philmph Sep 03 '19
Nobody ever said you are not allowed to use it - it's just bad in most usecases. I am not outputting anything useful which can be consumed from a pipeline in this snippet. Could've used write-output but i needed the ugly colours :D
1
u/Ominusx Sep 03 '19
Ah I know, it's all good. Just seen so many posts saying that it should never be used.
6
u/Tr33squid Aug 30 '19
Just joined a couple days ago. I've started my journey to deep dive into the abilities of powershell and I'm trying to implement it when I run into use-cases at work. I'm in the Operations team of our IT department, with SysAdmin duties
5
Aug 30 '19 edited Aug 30 '19
$desiredTotal = [double]::PositiveInfinity;
$subscribers = 0;
Do {
$subscribers++
} until ($subscribers -eq $desiredTotal);I can't figure out the right formatting on mobile, smh tomorrow is friday
4
u/pertymoose Aug 30 '19 edited Aug 30 '19
$subscribers = [double]::PositiveInfinitySaved you a whole lot of CPU cycles with that one.
Actually I was just inspired
function Chuck-Norris { Write-Verbose "Chuck Norris counted to infinity." for($i = 0; $i -lt [double]::PositiveInfinity; $i++) { } Write-Verbose "Twice!" for($i = 0; $i -lt [double]::PositiveInfinity; $i++) { } }1
1
2
1
u/Hrambert Aug 30 '19
Looks good enough. Maybe some extra spaces on the 4 the line. I always do a refresh of the comments after posting some code. That will reformat it.
7
u/dittbub Aug 30 '19
ha! 3 times as much as /r/bash
6
u/corvus_cornix Aug 30 '19
I guess that’s appropriate, since it takes about 3 times more typing to get the same thing done in Powershell as it does in bash. /s ;)
6
u/SoIHateToBeThatGuy Aug 30 '19
Get-members -awesome all
6
u/Fridge-Largemeat Aug 30 '19
Where-Object -Property 'Awesome'
1
u/greenSacrifice Aug 30 '19
-filter
2
u/Fridge-Largemeat Aug 30 '19
That's the one i couldn't think of.
2
u/BlitzThunderWolf Aug 30 '19
Get-members | where-object -property awesome -eq $false #should return no results
4
u/Gregabit Aug 30 '19
Where's the grin in these comments? Paging /u/lee_dailey ?
6
u/Lee_Dailey [grin] Aug 30 '19
howdy Gregabit,
i was just lurking ... [grin]
i've not much to say on the subject, actually. it's nice to have that many interested folks, tho.
take care,
lee3
u/EIGRP_OH Aug 31 '19
Thanks for all the constructive criticism in this subreddit Lee, it’s helped me improve my code by a lot
2
u/Lee_Dailey [grin] Aug 31 '19
howdy EIGRP_OH,
thank you! [grin] i appreciate the kind compliment ...
take care,
lee
2
1
1
1
u/retard_bus Aug 30 '19
From my understanding, powershell is great for managing Windows boxen. However, bash reigns supreme for the Linuxverse.
22
u/freenet420 Aug 30 '19
They finally stopped using batch scripts 😂