r/PowerShell • • Dec 15 '16

dbatools - an open source project, now with over 100 PowerShell commands for DBAs. Here's our most recent release! • /r/SQLServer

Thumbnail
reddit.com
122 Upvotes

r/PowerShell • • Jul 27 '16

Power Shell rumored to be open sourced soon

Thumbnail
twitter.com
122 Upvotes

r/PowerShell • • May 03 '21

State of the union or what is going on with PowerShell contributors community

121 Upvotes

Two PowerShell contributors, whose work I respect enormously, have just left the community. Unfortunately the writing was on the wall for some time already. We should not have PRs that wait months or years for core team to react or take enormous lobbying skills to get through. My question is what we as community can do about it? What we should change? Is RFC straightforward enough or should we take example from other languages? I do love PowerShell and it saddens me to see passionate contributors leave the community.

Additional sources:

https://twitter.com/JustinWGrote/status/1388256310014005249 https://twitter.com/peahenamonglox/status/1388243273764978700 https://twitter.com/markekraus/status/1389004494525001728 https://twitter.com/alexandair/status/1388750310701682692


r/PowerShell • • Mar 03 '21

Powershell scripts for beginners

121 Upvotes

r/PowerShell • • Dec 23 '20

Script Sharing Merry Christmas

121 Upvotes
Write-Host ' '
Write-Host '    _\/_' -ForegroundColor Yellow
Write-Host '     /\'  -ForegroundColor Yellow
Write-Host '     /\'  -ForegroundColor Green
Write-Host '    /  \' -ForegroundColor Green
Write-Host '    /'    -ForegroundColor Green      -NoNewline
Write-Host '~~'       -ForegroundColor DarkYellow -NoNewline
Write-Host '\'        -ForegroundColor Green      -NoNewline
Write-Host 'o'        -ForegroundColor Red
Write-Host '   /'     -ForegroundColor Green      -NoNewline
Write-Host 'o'        -ForegroundColor Red        -NoNewline
Write-Host '   \'     -ForegroundColor Green
Write-Host '  /'      -ForegroundColor Green      -NoNewline
Write-Host '~~'       -ForegroundColor DarkYellow -NoNewline
Write-Host '*'        -ForegroundColor Yellow     -NoNewline
Write-Host '~~~'      -ForegroundColor DarkYellow -NoNewline
Write-Host '\'        -ForegroundColor Green
Write-Host ' o'       -ForegroundColor Red        -NoNewline
Write-Host '/    '    -ForegroundColor Green      -NoNewline
Write-Host ' o'       -ForegroundColor Red        -NoNewline
Write-Host ' \'       -ForegroundColor Green
Write-Host ' /'       -ForegroundColor Green      -NoNewline
Write-Host '~~~~~~~~' -ForegroundColor DarkYellow -NoNewline 
Write-Host '\'        -ForegroundColor Green      -NoNewline
Write-Host '~'        -ForegroundColor DarkYellow -NoNewline
Write-Host '`'        -ForegroundColor Yellow
Write-Host '/__'      -ForegroundColor Green      -NoNewline
Write-Host '*'        -ForegroundColor Yellow     -NoNewline
Write-Host '_______\' -ForegroundColor Green
Write-Host '     ||'  -ForegroundColor DarkRed
Write-Host '   \'     -ForegroundColor DarkGreen  -NoNewline
Write-Host '===='     -ForegroundColor Red        -NoNewline
Write-Host '/'        -ForegroundColor DarkGreen
Write-Host '    __/' -ForegroundColor DarkGreen
Write-Host ''

r/PowerShell • • May 31 '20

Information Win10-Initial-Setup-Script v3.9 w/ W10 v2004 - Line by Line description of what it does

121 Upvotes

Just updated the guide since Windows 10 2004 came out AND & Win10-Initial-Setup-Script v3.9 came out 1 month ago too. Perfect timing.

Line by Line description of what Win10-Initial-Setup-Script v3.9 does (What happens if you disable or enable each line)

For the Uninitiated: The Win10-Initial-Setup-Script is a powerful (and potentially dangerous) script that can easily help customize your Windows 10 experience. You know those little things you change every single time you reinstall windows? Well, this script can be set up so it will automatically turn on and off about 200 settings so you don't have to.


r/PowerShell • • Aug 27 '19

Audible.com's audiobook version of "Learn Windows PowerShell in a Month of Lunches" is horrible.

121 Upvotes

https://www.audible.com/pd/Learn-Windows-PowerShell-in-a-Month-of-Lunches-Audiobook/B07W4MFM8P

Audible.com's audiobook version of "Learn Windows PowerShell in a Month of Lunches" is horrible. While the book itself (together with "Learn PowerShell Scripting in a Month of Lunches") is an excellent introduction to PowerShell, this version of it is basically unusable: the performer's choices are distracting, and content from the printed book is missing.

The narrator's performance is utterly distracting. His prosody is a combination of "announcer reading ad copy" and "parent performing a children's book". Much of the time, the performer gives equally huge emphasis to every word of his sentences, or he gives certain words weirdly inappropriate emphasis: it is a weirdly mocking tone. The performer also occasionally mispronounces technical jargon that is common in this domain. and his rate of speech is a bit rushed in comparison to that of the narrators of similar books. As early as the introduction, the narrator unaccountably repeats some sentences (this does not occur in the printed version). All of this distracts to the point that learning is unlikely if not impossible.

Another problem is the editing of the material for audio presentation. Naturally, technical books such as this one do not lend themselves well to audio presentation, as it includes frequent examples of code that are difficult to read verbatim without sacrificing clarity, flow, and/or engagement. That issue could be mitigated in several ways, but the approach in this rendition of the book is arguably the worst:

  • Code is usually skipped altogether, with no overt indication that something was skipped. [Edit: I want to emphasize here that the problem isn't that the code is skipped-- it's that the code is skipped without any comment or other indication that something was skipped. I'd be fine if the narrator were to refer the listener to a supplemental PDF for the code.]

  • Code is skipped in a haphazard fashion. For example, In section 4.9.2, the narrator skips the code following "The following are correct:" but he reads the code following "But these examples are all incorrect:".

  • The downloadable PDF does not present all of the code examples that is skipped in the narration. For example, the PDF is missing the code that the narrator skips in section 4.9.2.

I am dismayed that Manning and/or Audible elected to release an audio version of such poor quality for a book whose printed version is so excellent. I had been hoping to use this book to refresh the knowledge I had gleaned from the printed book in the past, but this audiobook is useless. If you want this book in audio, you would genuinely be better served purchasing the eBook version from Manning.com and running it through a text-to-speech app.

If I were Don Jones or Jeffery Hicks, I'd be apoplectic.


r/PowerShell • • Apr 14 '19

Script Sharing Convert Images to ASCII Pictures

Thumbnail
github.com
121 Upvotes

r/PowerShell • • Apr 08 '23

ShellGPT - A PowerShell Module for the APIs of OpenAI

120 Upvotes

Hei everyone

While trying to get a grasp of OpenAI's publicly available APIs, I stitched together a set of PowerShell functions that provide a simple interface for accessing OpenAI's GPT API endpoints that I wanted to share.

I called this Module "ShellGPT" and it is available on Github: https://github.com/yamautomate/ShellGPT

With it, you can generate natural language text, translate text, summarize articles, create images, create fine-tuned models, feed text-files, PDFs, .JSONs and more.

It provides a straightforward syntax for calling the API and handling the response, making it easy to integrate GPT into your PowerShell scripts. This means you can now leverage the power of OpenAI's GPT language model directly from PowerShell and your scripts and runbooks.

It is far from perfect but does the job.

Feel free to raise issues, clone, fork or contribute :)

PS: I think I need to rename it. There seem to be some other ShellGPTs...


r/PowerShell • • Sep 17 '22

Information PowerShell Community Textbook Update: To be released this weekend!

120 Upvotes

Gday Everyone,

Just a quick message to let everyone know that "Modern Automation with PowerShell" will be released on leanpub this weekend.

For people waiting for physical copies, I need to conduct one, final, review of the printed manuscript, which will be happening in the coming weeks (once the test copy can be printed and sent to me for review).

I'm not sure when, but I plan to conduct a podcast review and retrospective with authors and editors from this and other books. Stay tuned.

Cheers,

PSM1.


r/PowerShell • • Dec 16 '21

Script Sharing How to detect the Log4Shell vulnerability with Powershell

Thumbnail
joseespitia.com
120 Upvotes

r/PowerShell • • May 27 '20

Question What happened to the 'What have you done with PowerShell this month?' posts?

120 Upvotes

Hi /r/Powershell,

I really enjoyed reading/contributing to those. Maybe the mods can answer?


r/PowerShell • • Oct 06 '19

PSApi: ultra-fast way to create a webservice

120 Upvotes

I've published PSApi to the Powershell Gallery today. It is intended as a super-lightweight way to create a webservice. Quickest way to explain is probably with a screenshot.

The design goals were:

  • To be minimalist. If you can write a function you can create a webservice from it. Defaults should do most of the heavy lifting.

  • To be efficient. The "server" is multi-threaded so should be able to handle quite a lot of requests.

  • To work cross platform.

  • To be relatively secure*. Commands are walked for dependencies and custom runspaces are built from them.

(Security is hard. I encourage anyone to see if they can exploit this somehow. I would love to hear about it so it can be fixed.)

The module is on the gallery, so you can install it with

Install-Module PSApi -Scope 'CurrentUser'

Source is available on GitHub. This is version 0.0.9. Expect some bugs, and please do let me know, if you run into any. Contributions are welcome, as long as they fit within the design goals outlined above.

The use cases I envisioned for this was creating monitoring points, the ability to create simple mock-up services, and generally being yet another tool in the box used to "glue" PowerShell together with other things. It can do a whole lot more than that, though.

Here is a simple function for getting user pictures from your AD, provided you've populated the thumbnail property (expanded version here that also does high quality rescaling). It uses ADSI, because Core. Publish-Command UserPhoto and you have an image service.

function UserPhoto ($user) {
    $user_data = ([adsisearcher]"(&(objectClass=user)(sAMAccountName=$user))").FindAll()
    $stream = [System.Io.MemoryStream]::new($user_data.Properties["thumbnailphoto"][0])
    $img = [System.Drawing.Image]::FromStream($stream)
    $img
}

Lots more information can be found on GitHub, regarding usage, how to run as non-administrator, how to post funky parameters, etc. But generally: just Publish-Command <function> and you're done! :)

Enjoy!

Edit: *Just a clarification. Security in this context doesn't mean authentication, this module provides none. Focus on security here is in trying to protect the integrity of the machine serving the commands.


r/PowerShell • • Jul 23 '19

Use PowerShell delete a user profile (step-by-step guide)

Thumbnail
adamtheautomator.com
120 Upvotes

r/PowerShell • • May 17 '19

2019 PowerShell Summit - YouTube

Thumbnail
youtube.com
120 Upvotes

r/PowerShell • • Nov 16 '22

Get-ADUser (ie) trick I just found...

119 Upvotes

Perhaps I'm just dense, and this is a 'No brainer

That being said... I was playing around with Get-ADUser...

And I have no idea if anyone would find this useful, but what the heck... Enjoy, or don't.

I wanted to see if this could be shortened:

Get-ADUser -Filter * -Properties * | ? {$_.MobilePhone} | Select Name, Department, Title, MobilePhone, OfficePhone, Office, City

I figured I'd see if rather that listing out the attributes I need in the same line as the command (such as above), I'd try to drop the attributes I need, into a variable (that I could use elsewhere easily, or find and modify quickly, in a script...).

I was surprised to see that this (example) works... (and this would of course, work in anything similar).

$Props = @('Name', 'Department', 'Title', 'MobilePhone', 'OfficePhone', 'Office', 'City')

Get-ADUser -Filter * -Properties $Props | ? {$_.MobilePhone} | Select $Props

It was an 'Ah ha' moment for me.

Thought I'd share it.


r/PowerShell • • Sep 23 '21

what's that one thing you learned that once you learned it changed how you used powershell

119 Upvotes

for me it was when i got my head around jobs. really opened up what i could do.


r/PowerShell • • Apr 06 '21

Optimizing your $Profile

Thumbnail
devblogs.microsoft.com
119 Upvotes

r/PowerShell • • Mar 08 '21

I made a script to update your desktop wallpaper to today's top upvoted reddit wallpaper

119 Upvotes

You can change the subreddit to another one, not all work but some like r/wallpaper r/wallpapers r/earthporn r/carporn etc. Mostly ones that allow only pictures to be posted

https://github.com/0Nikola0/SnuePape

Be sure to read the readme in case you the SSL error


r/PowerShell • • Sep 01 '20

News 8 Quick and easy tips to get you started with PowerShell

Thumbnail
koupi.io
119 Upvotes

r/PowerShell • • Jul 02 '20

Chapter 8 - Switch Statements

Thumbnail
youtu.be
119 Upvotes

r/PowerShell • • Feb 12 '19

PowerShell Basics: Troubleshooting Active Directory Replication Issues

Thumbnail
techcommunity.microsoft.com
119 Upvotes

r/PowerShell • • Aug 31 '20

Comprehensive list of best practices for writing the worst code. [Humor]

Thumbnail
github.com
118 Upvotes

r/PowerShell • • Apr 28 '20

jfhbrook/PSeudo - Execute PowerShell commands as Administrator in Windows 10 "like sudo"

Thumbnail
github.com
118 Upvotes