Comments on: Powershell http://www.terminally-incoherent.com/blog/2013/10/14/powershell/ I will not fix your computer. Tue, 04 Aug 2020 22:34:33 +0000 hourly 1 https://wordpress.org/?v=4.7.26 By: A list of things you may possibly need, but maybe not (2013 edition) | Terminally Incoherent http://www.terminally-incoherent.com/blog/2013/10/14/powershell/#comment-60724 Mon, 30 Dec 2013 15:05:10 +0000 http://www.terminally-incoherent.com/blog/?p=15715#comment-60724

[…] and it provides much more utility and flexibility than the spartan and limited default shell. I wrote about it earlier this year. If you do use it I highly recommend also checking out the […]

]]>
By: Luke Maciak http://www.terminally-incoherent.com/blog/2013/10/14/powershell/#comment-56820 Sat, 19 Oct 2013 21:20:37 +0000 http://www.terminally-incoherent.com/blog/?p=15715#comment-56820

@ Jeffrey Snover[MSFT]:

Heh, today I taught MS Engineer a new thing about Powershell. :P

But yeah, after a few seconds of reflection I figured out that the decision was made to stave off use of Powershell as a virus delivery vector. Good to hear servers will now have it enabled by default.

In the meantime, you can still pretty reliably use PS scripts on client side – you just need a batch file wrapper:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex script.ps1"

Or you can execute a script from the web:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://example.com/script.ps1'))"
Reply  |  Quote
]]>
By: Jeffrey Snover[MSFT] http://www.terminally-incoherent.com/blog/2013/10/14/powershell/#comment-56818 Sat, 19 Oct 2013 16:31:09 +0000 http://www.terminally-incoherent.com/blog/?p=15715#comment-56818

> Seriously, what the fuck happened there? What was the reasoning behind it?

Oh that. Good question. Simple answer:
ILoveYou.vbs
I’d like to be remembered after I die but not for being the guy that brought down the internet and destroyed Microsoft in the process.

Now that we have a quite a few drama-free years behind us and the use of PowerShell has become a critical IT activity, we have re-evaluated a number of our initial security decisions for Windows Server (but not client – the % of client machines that use PS means we still want to be cautious).
In WS2012 we turned remote management on by default.
In WS2012/R2 we set the default execution policy to RemoteSigned.

Apologizes for the PITA initial config but if we were not abundantly and overly cautious and something had gone wrong – the immune system reaction would have been swift and decisive and there would be no PowerShell and we’d all be flipping hamburgers. :-)

Jeffrey Snover [MSFT]
Distinguished Engineer and Lead Architect for Windows Server and System Center

Reply  |  Quote
]]>
By: Jeffrey Snover[MSFT] http://www.terminally-incoherent.com/blog/2013/10/14/powershell/#comment-56817 Sat, 19 Oct 2013 16:20:28 +0000 http://www.terminally-incoherent.com/blog/?p=15715#comment-56817

$serial = (gwmi Win32_SystemEnclosure).SerialNumber
(gwmi Win32_ComputerSystem).Rename($serial)
Restart-Computer -Force

Whoaa – I didn’t see that one coming.
I love it!

Jeffrey Snover [MSFT]
Distinguished Engineer and Lead Architect for Windows Server and System Center

Reply  |  Quote
]]>
By: Luke Maciak http://www.terminally-incoherent.com/blog/2013/10/14/powershell/#comment-56158 Wed, 16 Oct 2013 02:05:35 +0000 http://www.terminally-incoherent.com/blog/?p=15715#comment-56158

@ Grzechooo:

Not really, sorry. I mean, it’s a shell so you kinda learn it the way you learn every shell – by using it. Instead of opening cmd, just use powershell, and whenever you need to do something fancy, google how to do it in it. That’s kinda how I learned Bash and how I cobbled together cmd.exe Batch scripts.

Probably the best part of Powershell is that most of things return objects, so you typically don’t need to parse output to get the chunks you need. And if and when you do get a string, it is actual proper string object so you can do things like:

"foobar".Substring(0,3)

This alone makes it a 100% improvement over the string parsing in Batch files.

@ Eric:

Actually, I kinda cheated and used this registry hack. On my machine (win7pro) it turned cmd.exe to solarized like color scheme, but not the default Powershell console which remained blue. So I popped up the Properties section and just kinda copied the color codes over from the other one.

It works ok, but the default windows console is not really 256 color terminal so you can’t even get close to the actual full range. If you want actual solarized support using 3rd party terminal like ConEmu is probably your best bet. :)

Reply  |  Quote
]]>
By: Eric http://www.terminally-incoherent.com/blog/2013/10/14/powershell/#comment-56148 Wed, 16 Oct 2013 01:39:42 +0000 http://www.terminally-incoherent.com/blog/?p=15715#comment-56148

Powershell is great. I add the cygwin\bin directory and vim to the path, and together the combination makes me not hate Windows at all.

I also use it in combination with group policy as my main scripting language for supporting Windows P.C.’s.

My only complaint is I haven’t been able to find a solarized color scheme. When I saw this post I was hoping you would have had a workable solution in your Powershell profile. But great post anyway, I’m glad to see other command line aficionados appreciating Windows.

How to tell if Powershell Inventor Jeff Snover is driving in front of you.
http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-co mponents-postattachments/00-02-28-75-22/PowerShellLicensePlate.jpg

Reply  |  Quote
]]>
By: Grzechooo http://www.terminally-incoherent.com/blog/2013/10/14/powershell/#comment-56018 Tue, 15 Oct 2013 13:38:43 +0000 http://www.terminally-incoherent.com/blog/?p=15715#comment-56018

I’m not using Powershell much, but now you’ve got me interested. Do you know of any “tutorials” other than RTFM aka Get-Help?

Reply  |  Quote
]]>