Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 12 KB, 391x256, powershell.png [View same] [iqdb] [saucenao] [google] [report]
59483292 No.59483292 [Reply] [Original] [archived.moe] [rbt]

PowerShell is not very discussed on /g/ for some reason, although it has it's merits in the Windows World

Do you use it?
What is your opinion on it?
Any cool scripts that you can share?

>> No.59483313

>Windows World
/thread

>> No.59483330

>>59483292
it sucks
microsoft should have made it in 1995 when NT 4.0 came out when people wanted it. Fuck powershell and fuck Microsoft.

>> No.59483373

i guess its actually really nice for developers or admins but to me, a consumer, its just another one of those weird Post-Vista replacement programs ment to bring cohesion to the wild native windows ecosystem.


Maybe i've just spent too much time with linux, and the KISS + pseudo-UNIX philosophies, but windows is a fucking mess and a real pain to deal with when you just want to find out why its SUDDENLY slowing down or freezing when nothing on your end has changed.

It has a mind of its own and it delve into that you need tons of programs. I imagine programs like powershell are ment to somehow make it easier, but overall its just nigger rigging

>> No.59483385

>>59483292
foreach ($i in 1..$args[0])
{
$fizzarray = @($i,"fizz","buzz","fizzbuzz")
$o = 0
if ($i % 3 -eq 0) {$o += 1}
if ($i % 5 -eq 0) {$o += 2}
write-host $fizzarray[$o]
}


Here's a fizzbuzz script I wrote :^)

but I gave up on powershell because I have adhd and can't focus

>> No.59483416

Virtually irrelevant with the advent of WSL.

>> No.59483422

>>59483292
>Do you use it?
Every day
>What is your opinion on it?
Beautiful language
>Any cool scripts that you can share?
Nah

>> No.59483480

>2017
>cli

Just kill yourself.

>> No.59483486

does anyone know of a good book to learn powershell?

>> No.59483570

>>59483480
>not cli
>2017
t. normie babby

>> No.59483594

>>59483570
t. retard

>> No.59483915

>>59483313
But it runs on Linux...

>> No.59483939

>>59483486
PowerShell in a month of lunches would be your best bet.

>> No.59483987

>>59483330
Better than bash
Objects > Text

>Unstrutured text in a structured system
>In the year of our Lord 2011+6

>> No.59484111

>>59483292
the windows users here are gamers. they dont need command lines.

>> No.59484155

>>59483292
PowerShell is a clusterfuck for end users. I use it every day, to bypass AntiVirus solutions and carry out my duties as a pentester. It's really scary how much lateral movement, persistence, and evasion you can do with PS. AV doesn't pick it up, so its a quick way to get DC creds.

>> No.59484204

Better than bash, zsh.
ISE is a dream.

Come at me.

>> No.59484364

>>59483292
Makes managing active directory and exchange a fuck load quicker

>> No.59484445

>>59484155
>AV doesn't pick it up
Depends on the AV, Defender will on Windows 10 and newer.
Also if you're trying to get around anyone competent they'll have PS logging setup to track everything.
But for now it's pretty much a free lunch in most places.

>> No.59484628
File: 98 KB, 900x900, 1489945952315.jpg [View same] [iqdb] [saucenao] [google] [report]
59484628

I use PowerShell professionally for quite a few years now. It's all because of this one fuck in my company who keeps pushing every single stupid Microsoft product which nobody fucking ever uses. Shit always boils down to "but it's integrated with office hurrdurr", managers eat it up and the office plugins/extensions are always abandoned so nobody uses it. The fucking TFS build/release workflow is the most cancer-inducing shit. Microsoft never responding to bug-reports unless you're a billion-employee company. Fucking updates removing important features every once in a while and adding retarded fucking eye candy similar to desktop stripper. But to get back to the point - I fucking hate PowerShell. I hate everything about it. There is no reason for it to exist or to replace the old command prompt. The syntax rules gave me terminal leukaemia. The inconsistent usage of cmdlets murdered my daughter. The fact that you can find "TODO: add documentation" comments on MSDN. The fucking comparison operators. The fucking occasional case-(in-)sensitivity of random tokens. Fucking lists. Fucking string concatenation and interpolation. The ISE sucks big dick. Debugging is a nightmare. No remote execution except for RDP (full GUI) and/or turning on WinRM and then using goddamn Invoke-Command where half of the calls execute on your local machine. The piss-drinking syntax for using .NET types and namespaces. For fuck's sake it created a new "level" of DLL hell: you are able to load different fucking versions of the same DLL and then everything using either one of them stops working always throwing an exception saying it couldn't find the type/class in the assembly. Oh and you cannot unload the DLLs - you gotta start a new session. The fact that scripts continue executing if a cmdlet threw an exception. The fact that if you run an external program the last exit code is stored in a global variable so there's no way to do parallel execution of external programs. It's just bad.

>> No.59484831

>>59484628
What features got removed in an update?

>> No.59485348

>>59484628
I don't think you know how to use PowerShell.

>. No remote execution except for RDP (full GUI) and/or turning on WinRM and then using goddamn Invoke-Command where half of the calls execute on your local machine.

Most cmdlets can execute with cum, you should use that.

>For fuck's sake it created a new "level" of DLL hell: you are able to load different fucking versions of the same DLL and then everything using either one of them stops working always throwing an exception saying it couldn't find the type/class in the assembly.

V5 has the using key word now to let you specify different versions now. Still can't remove them after but you really should be importing them in a module anyway.

>The ISE sucks big dick. Debugging is a nightmare.
VS Code has addresses this part, it eases the trouble of using the built-in debugging tools.

>The fact that scripts continue executing if a cmdlet threw an exception.

Most cmdlets don't throw terminating exceptions, you need to set the ErrorAction.

>The fact that if you run an external program the last exit code is stored in a global variable so there's no way to do parallel execution of external programs.

However your starting the programs is wrong, look into Start-Process with the -PassThru parameter.

>> No.59485376

Really powerful but holy fuck is it a nightmare to write in

>> No.59485465

>>59483385
Holy shit, this is tenfold worst than bash. Disgusting.
for i in {1..100} ; do
out=""
(( $i % 3 == 0 )) && out="Fizz"
(( $i % 5 == 0 )) && out="${out}Buzz"
echo ${out:-$i}
done

>> No.59485484

My first scripting language was Bash but my first time playing with objects is in PS.
I use it at work for Systems automation. As of now, 100% of our user onboarding/offboarding is a powershell workflow and we have a handul of autorecovery routines written in powershell that are fired off by solarwinds.

The only thing I don't like is that some features are tied to the powershell version and some are tied to the version of the operating system. I'm never completely certain a script will work across the entire enterprise because of it.

Also if you're YOLOing in prod, there's a lot of ways to be dangerous with powershell. All it takes is fucking up a pipeline to start your very own rm -rf disaster. Powershell uses your own level of accesses, but just because I want a helpdesk operator to be able to disable an AD account doesn't mean I want them to be able to run "get-aduser | set-aduser -enabled $false"

>> No.59485548

>>59483292
>Do you use it?
No.
>What is your opinion on it?
It's stupid. Most servers run Linux with Bash built in, so it's useless for work.
>Any cool scripts that you can share?
No.

>> No.59485693

>>59485465
For fizz buzz, sure but it's much nicer for system administration.

For example getting all files over 10mb in PS is very straight forward.
ls | where Length -gt 10MB
In bash you deal with textual data sort you need to hack and slash the output. Not bad but you loose gaurantees on what you get back.

>> No.59485756
File: 27 KB, 400x396, 1416646108240.jpg [View same] [iqdb] [saucenao] [google] [report]
59485756

>>59485693
>piping ls

>> No.59485785

>>59485756
In PS ls is an alias for get-childitem.

>> No.59485867

>>59483292
The language is fucking terrible, so I never looked too much further into it. Why couldn't they adopt a proper modern programming language since they made it so recently? They could have made it run even with python ffs.

>> No.59485892

>>59484628
>Microsoft never responding to bug-reports unless you're a billion-employee company.

to be fair they probably can't fix it because they already have like a shitload of other bugs to fix. But ya, M$ insider favoring si fucking cancer.

M$ needs to nuke their shit from orbit or refactor their whole fucking software stack.

>> No.59485926

I fucking hate it. I manage an IIS serv and I needed to write an archiving script and it was the most awkward "thing". I ended up caving and just writing it in ruby.

>> No.59485975

>>59485867
python isn't not made there, that's why.

I'm surprised they got the ansible cucks to develop powershell garbage just for winusers.

>> No.59486225

>>59485867
They started it back in 2002 .... with the first public beta for xp back in 2005

>> No.59486306

It's great for windows malware.

>> No.59486390

>>59484111

you forgot pajeets

>> No.59487760
File: 37 KB, 1362x367, Untitled.png [View same] [iqdb] [saucenao] [google] [report]
59487760

>>59483292
A blue command prompt that nobody asked for. Absolutely useless.

>> No.59488095
File: 33 KB, 673x494, powershell.png [View same] [iqdb] [saucenao] [google] [report]
59488095

>>59487760
>blue
hmmmM?

>> No.59488241

>>59488095
Console 2 is the shit

>> No.59489171

>>59483416
This is untrue. PoSh has a use case, which is in managing Windows and Windows servers, that WSL cannot accomplish in its current state. It's a scripting language for those who want to script less painfully than in cmd: a middleware scripting layer between COM-enabled applications and the sane world.

>> No.59490630
File: 1.97 MB, 3167x1928, 4L_SBL45epo.jpg [View same] [iqdb] [saucenao] [google] [report]
59490630

>>59483292
>Linux fags will never experience the glory of powershell.

You don't deserve it anyway.

>> No.59492818

>>59483292
>You have to have an admin enable scripts before running any userscript
>Even then you still need to confirm running one
>Still no elevation support
>Doesn't look or work like any existing language

I hate Microsoft. I fucking hate them.

As a minor consolation, vbscript can do most of what powershell does for non-network usages and it's a lot less confusing. Otherwise there's Autoit which can compile standalones.

>> No.59492836

>>59490630
woah dude did you just literally list ALL the files in the current directory? fucking amazing

>> No.59492847

>>59487760
People have been asking for a scripting language that was more powerful than command prompt.

>> No.59492927

it's a great language. some features are missing. Easy debugging with the ISE, Try-Catch for errors is pretty cool, WMI .NET give you barely any limitations. Good AD module. Sadly ACL is still clunky to use and so on, but made life easier as sysadmin.

>> No.59493498

>>59483292
Used it for the first time yesterday to automate unzipping or archivea and deleting leftover files.
Took me a while to get it to work but it's actually really easy and nice

>> No.59493956

>>59487760
>>59487760
>not knowing how to customize the CMD
awwwwwwwww

I got called to managers office one time because they got the report that I was installing shit at the servers.

>ok show me the evidence
This screenshot, you installed an alternate command...
>excuse me, I had the font size changed because I was in remote desktop from a cellphone attending this midnight call from a smartphone
>surely the person that reported this to you forgot to tell that we needed to roll back a change he made in the middle of the night of the payroll day
>I attended the case as soon as possible but I had no access to my work computer and I would not connect to our systems from an untrusted computer
grrrrrrr you can go anon

true story.gif

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action