Powershell

1025 readers
1 users here now

PowerShell (POSH) is a a task automation command-line shell and scripting language created by Microsoft. It became part of the FOSS community in 2016 and is now available across Windows, Linux, and macOS

Resources:


Rules:

Self-promotion rules:


founded 1 year ago
MODERATORS
51
 
 

Announcements!

Blogs, Articles, and Posts

  • Using PowerShell and Twilio API for Efficient Communication in Contact Tracing
    Learn to integrate PowerShell with Twilio API and streamline communication for COVID-19 contact tracing initiatives.
  • Automate Text Summarization with OpenAI and PowerShell
    This easy-to-follow guide shows you how to use PowerShell to summarize text using OpenAI's GPT-3.5 API.
  • Terminal Chat in Windows Terminal Canary
    At Build 2023, we announced that Windows Terminal users will be able to take advantage of natural language AI to recommend commands, explain errors and take actions within Windows Terminal. Since then, we have been listening to customer feedback and iterating on our AI chat experiments in Windows Terminal.
  • Streamlining Security: Converting CRT Certificates to PEM
    Dive in and learn how to use and to convert CRT certificates to PEM via PowerShell scripts in this ATA Learning tutorial!
  • Reporting User and Group Assignments for Enterprise Applications
    A reader asked how to report user and group assignments for enterprise apps. As it turns out, this isn't particularly difficult, if you know where to look. Our script uses the Graph SDK to check service principals, filters out the apps to check, and extracts the user and group assignments before reporting what it finds.
  • Generating PowerShell module documentation with platyPS
    Creating accurate and efficient documentation is paramount in technical writing, especially for PowerShell modules. platyPS, an open-source module, emerged as a solution for generating Markdown-based reference content for PowerShell modules. This article provides a comprehensive guide for using platyPS to create and maintain high-quality reference documentation for your PowerShell module, enhancing the experience for both module authors and users.
  • Microsoft Intune PowerShell Detection scripts
    When I deploy Win32 packages in Intune, I use PowerShell detection scripts to detect if the software is installed on a system. In the blog post, I will show you how they work and why they are more flexible than file and registry checks. What are detection scripts in Intune?
  • Where the heck is the PowerShell Module loading from?
    If you’re anything like me you always have PowerShell open, and often both PowerShell and Windows PowerShell. And PowerShell in VSCode and Terminal (and sometimes Jupyter Notebook, and WSL – Windows Subsystem for Linux).
  • Using a specific PowerShell profile for a Console session, Windows Terminal, PowerShell ISE, or Visual Studio Code
    I ran into this somewhere during this week. I wanted to have different PowerShell profiles for other applications. (I don't need all my functions and scripts being loaded in every PowerShell session or by a Scheduled Task) In this blog post, I will show you how to change your PowerShell profiles and make them specific for an application.
  • PowerShell Perfomance-Test: Get the Maximum
    Efficiency is key when working with PowerShell, and maximizing performance is a common goal for script developers. In this post, we'll explore various techniques for retrieving the maximum number from arrays of different sizes, comparing well-known approaches like Measure-Object, Sort-Object and a more mathematical method.
  • Ask Jeff November 2023
    I am amazed at how quickly the year is flying by, and there is so much left on my to-do list for 2023. I guess we’d better get right to the monthly wrap-up.
  • Getting Download Links from Webpages using PowerShell
    Introduction I recently had the need to update the Microsoft ODBC Driver for SQL Server on a collection of Windows servers.

Projects, Scripts, and Modules

  • Wingetposh v1.0.1
    Winget helper written in Powershel
  • PowerShell-ALC
    Example ALC structures to use with in a PowerShell module - GitHub - jborean93/PowerShell-ALC: Example ALC structures to use with in a PowerShell module

Books, Media, and Learning Resources

Community

  • In Code We Trust: Being Thankful for PowerShell
    In this special gratitude-filled episode of the PowerShell Podcast, we take time to appreciate the wonderful world of PowerShell - where tech and community coalesce. We highlight some splendid community projects, highlighting their large impacts and innovative approaches. As we recall our podcast journey, we revel in a nostalgic look back while also envisioning a powerful future. From personal anecdotes revealing how PowerShell has shaped our tech lives to a thought-provoking expose on error handling, the episode is a wholesome tableau of learning, reflection, and connection. It's a delightful mix of the cerebral and the personal - with plenty to be thankful for!
  • PowerShell Summit & More: A Chat with James Petty
    In this episode of the PowerShell Podcast, we were joined by Microsoft MVP and PowerShell.org CEO James Petty. We dove into the core of what PowerShell.org brings to the community and James' instrumental role in driving this platform forward. James shared insightful details about the future of the eagerly awaited PowerShell Summit, highlighting the significant and welcome changes in store for next year. The conversation also hailed his latest literary creation, 'Learn PowerShell Scripting in a Month of Lunches,' as we explored the evolution in content and approach compared to its predecessor. Adding to this rich mix were James' anecdotes from his time as a professor teaching PowerShell at a college, providing a truly riveting podcast that celebrates the wide-reaching influence of PowerShell.
  • OnRamp2024 Program Unveiled
    The PowerShell + DevOps Global Summit proudly announces the OnRamp Program for 2024 to foster inclusivity and provide opportunities for aspiring IT professionals.
  • PowerShell Pulse: Monthly Tech Talks & Community Showcase
    Welcome to PowerShell Pulse, a monthly virtual gathering that brings the vibrancy and innovation of the PowerShell community right to your screen! Call for speakers now open.

Fun

  • Automating life tasks
    Been automating a lot of my task at work away with powershell. What are some things in your daily life that you could use powershell to automate away?
  • Let's have a look at what commands we use
    Let's have a look at what commands we use. GitHub Gist: instantly share code, notes, and snippets.

Events

Check out psweekly.dowst.dev for all past editions as well as a searchable archive.

52
53
 
 

Announcements!

Blogs, Articles, and Posts

Projects, Scripts, and Modules

  • PSZoom v 2.0.4.2
    A collection of Powershell tools to interface with the Zoom Api.
  • Get Microsoft 365 License Usage Count Using PowerShell
    Keeping an eye on the available licenses in your Microsoft tenant is essential to ensuring you and your users have what is needed to keep the business running. Whether you assign licenses directly or you use Group Based Licensing

Community

  • Emil Larsson: Creating Communal Tech Waves with PowerShell
    In this episode of the PowerShell Podcast, we had Emil Larsson join us! We had a healthy amount of community blogs in this episode, with lots of great conversation all throughout. We discussed how helpful contributing to PowerShell docs can be. We learned about Emil's evolution with PowerShell and how the industry has changed in his 10+ years of experience. Emil and Andrew revisited their early IT days of grappling with upgrades from Windows XP to Windows 7, making all of us a bit nostalgic. We also had a fair bit of discussion around what the PowerShell community is all about.

Fun

Check out psweekly.dowst.dev for all past editions as well as a searchable archive.

54
55
 
 

If you are like me and have multiple machines you work on with different profiles, it can be difficult to remember which profile contains which functions. So, I wrote a quick function that will display all the functions for me on start up.

56
 
 

I've always developed and ran scripts locally through VS Code. I'm just getting started with Azure Automation and am not a fan of waiting for the job to complete before seeing my results. In fact, it's very frustrating. I'd rather develop and test my script locally first before running it in Azure Automation.

I'm using a user-managed identity to run scripts against Exchange Online. VS Code has an Azure Automation plugin that provides an option to run script locally, but the script bombs out when attempting to use the user-managed identity, as the user-managed identity may only be run in Azure.

For those of you who use Azure Automation, I can't imagine that you develop significant portions of the script and wait for automation jobs to complete each time to verify changes.

How do you develop locally? Do you use an app registration w/ client secret in key vault and call that from your local machine? Do you have a process for developing locally for scripts that specify managed identities?

Thanks everyone!

57
 
 

Azure Automation Run As Account will retire on September 30, 2023 and will be replaced with Managed Identities. Before that date, you'll need to migrate your runbooks to use managed identities.

However, just the presence of a Run As account doesn’t mean a it is being used. Often these were just created during the automation account provisioning. This script help to determine if you are using the Run As account by search through the runbooks to find references to the Run As Account actually being called. Then finds the last time the runbook was executed. If no date is returned, then the runbook has not executed in the last 30 days.

58
 
 

Enums were introduced to PowerShell in version 5.0 and can be used as a simple way to validate script and parameter input.

59
6
How to create PowerShell docs (mikefrobbins.github.io)
submitted 1 year ago by pwshguy to c/powershell
 
 

Go beyond comment-based help. Bring your own module and learn how to create the documentation to support it.

60
 
 

Announcements!

Blogs, Articles, and Posts

  • Find enabled local Group Policy settings with rsop.msc and PowerShell
    When it comes to GPO troubleshooting, you might want to find settings that are configured by local Group Policy. With rsop.msc, a graphical tool is available for this purpose. However, it is generally more efficient to generate a report using gpresult.exe and evaluate it with PowerShell.
  • Your Getting Started Guide to PowerShell Approved Verbs
    Discover how to get started with PowerShell Approved Verbs to make sure your scripts and code is top-notch in this ATA Learning tutorial!
  • How to optimize and speed up your PowerShell scripts
    My best practices, tips and tricks working with PowerShell This is a blog post that is not deeply technical. I will not go deep into the tips and tricks, because you will learn this automatically when you have more experience & when you are ready. I have a seperate blog post about best practices, tips … Continue reading How to optimize and speed up your PowerShell scripts
  • PowerShell Advanced Functions: Cmdlet Bindings and Parameters
    Part 1 of this series on advanced PowerShell functions introduces the key concepts, including cmdlet bindings and common parameters like ErrorAction.

Projects, Scripts, and Modules

  • Announcing PowerShell Crescendo 1.1.0-RC1
    This RC contains several community requested features and fixes including improved support for PSScriptAnalyzer, improvements to error handling, and the addition of ExcludeAsArgument property.
  • Using the Microsoft Graph PowerShell SDK to Generate a Mailbox Traffic Report
    Microsoft 365 makes it easy for administrators to get mail activity usage data for users. However, if you want to know which domains are sending most mail, you need to do some work. In this article, we cover how to use cmdlets from the Microsoft Graph PowerShell SDK to create reports about user mail activity over time and the traffic sent by different domains.
  • ServerCertificateValidationCallback (or rather, collector) for .NET Core
    ServerCertificateValidationCallback (or rather, collector) for .NET Core - Get-WebCertificate.ps1
  • About Colors.md
    When I'm having a bad day, I can spend hours just fiddling with colors and recursion. Today I wrote an HslEnumerator class which is fun because if you output it to the PowerShell terminal it just goes on producing colors forever:
  • Get-AadJoinInformation.ps1
    Get Azure AD (Entra ID) Join Information without dsregcmd

Books, Media, and Learning Resources

  • From Cloud to Console: Harm Veenstra’s PowerShell Perspectives
    We had a cool chat with Harm Veenstra, the guy behind powershellisfun.com. We got into some neat PowerShell stuff like Out-ConsoleGridView and the -PassThru parameter. Harm also gave us the lowdown on when to quit the cloud and spilled the beans on running his blog. Plus, he shared how he keeps up with the quick mojo of the tech world. Tune in for a fun and laid-back tech talk!

Community

Fun

  • PSQuizMaster
    A module for creating and running quizzes to learn PowerShell - GitHub - jdhitsolutions/PSQuizMaster: A module for creating and running quizzes to learn PowerShell

Check out psweekly.dowst.dev for all past editions as well as a searchable archive.

61
 
 

Hi everyone, I created this little tool in Rust to generate obfuscated looking glob patterns for paths by utilizing the default environment variables in Windows PowerShell.

You can check it out here: https://github.com/lavafroth/envy-rs

This can probably be used in conjunction with some other tools to bypass AV/EDR.

As you can guess, I'm not a PowerShell ninja. I did not come up with the idea. I learned about it from this video by John Hammond. I merely implemented the code.

62
 
 

Blogs, Articles, and Posts

  • Create a Hyper-V VM to run pfSense with a PowerShell script
    In this blog post, you’ll learn how to use a PowerShell script to create a Hyper-V virtual machine (VM) toContinue Reading
  • Function cannot be created because function capacity 4096 has been exceeded for this scope
    I had a long day today when my long-running script (10 hours) gave me weird errors with Microsoft Graph for Teams. Finally, I solved my mistakes and reran the hand to see if the report would be complete this time. Surprisingly, it gave me an error I'd never seen before. "Function cannot be created because function capacity 4096 has been exceeded for this scope". The error is at least weird because it's shown on a production server where I've just a handful of PowerShell modules installed, and I've never seen it on my development machine where I've over 200 modules.
  • Things I use most in my PowerShell scripts
    Looking back at the scripts I created the last year, certain things always come back in most of them. In this blog post, I will show you a few and explain them.
  • Find Who Created a User Account in Microsoft 365 | Audit User Creations 
    In Microsoft 365, user accounts act as gateways to access resources. Unauthorized or suspicious user creations can lead to severe consequences, such as data breaches and compromises in sensitive information. Admins play a critical role in safeguarding organizational data by […]
  • Ask Jeff July 2023
    Well, this has been a whirlwind month. I hope you accomplished much and still had time to learn a thing or two. As has been the custom here, let’s wrap up with grab bag of tips and suggestions.

Projects, Scripts, and Modules

Community

  • Björn Sundling. From PowerShell Developer to MVP: An Unfiltered Journey
    In our latest PowerShell Podcast, we invited Microsoft MVP Björn Sundling,  on a riveting journey from being a PowerShell developer to securing Azure DevOps repositories. With a passion for speaking seeded from his first year at PSConfEU 2015, his road to the podium wasn’t easy. The podcast was peppered with a detailed discussion on the automated scanner project PSSecretScanner. Offering insights into development technologies, this episode is a whirlwind tour of community involvement and encompasses his love of sharing knowledge.

Fun

  • Become the TEC 2023 PowerShell Script-Off Champion
    The TEC 2023 PowerShell Challenge Champion will be known after three rounds of frenetic script coding at The Experts Conference in Atlanta on September 19, 2023. Competitors will need a working knowledge of Microsoft 365 PowerShell, including Exchange Online, Teams, and Azure AD. Being able to think on your feet and come up with working solutions to problems is possibly a more important attribute than coding genius.

Events

Check out psweekly.dowst.dev for all past editions as well as a searchable archive.

63
 
 

Blogs, Articles, and Posts

Projects, Scripts, and Modules

Books, Media, and Learning Resources

Community

  • Culture, Mentoring, and Tech: A Talk with Glen Sarti
    In this episode of the PowerShell Podcast, Glen leads us on the journey of his wide-ranging career, sharing stories about his beginnings in the Powershell world and addressing his brave decision to move across the globe for his dreams. He unravels the complex world of DevOps, recounts experiences from his first talk on “DevOps, Desktop, and Odd Socks,” and offers valuable insights into building effective mentoring relationships. At the heart of the episode is his take on driving cultural change within organizations and his compelling comparison of technical versus social skills in the tech industry. This episode encapsulates numerous nuggets of wisdom from Glen, adding value and insights for listeners at all stages of their tech career.

Fun

  • Posh v0.1.1
    Posh is a PowerShell module that makes PowerShell more fun to work with.

Check out psweekly.dowst.dev for all past editions as well as a searchable archive.

64
 
 
65
 
 

Like the title says. Have you got powershell 7 installed on the machines you connect to or not?

66
67
68
69
70
71
 
 

I know there are a lot of options out there for DMARC report gathering, but as a project to get used to MSGraph API I wanted to write a script to send a csv report of our DMARC mailbox. It includes calls to our password manager to get the connection info for the application I made to interact with graph. It gives a csv that looks like this

I attempted to use a code block to post the directly here, but it didn't want to format correctly so here is the pastebin link

https://pastebin.com/VeZwkZhB

72
 
 

I have seen a lot of calls around Lemmy for more moderation tools. I have been working on Lemmy PowerShell module for a few weeks now, and I went ahead and released a preview version with multiple moderation tools now available. The module has the ability to perform the following tasks using a simple command line tool:

  • Search posts and comments
  • Remove a post
  • Remove a comment
  • Lock and unlock posts
  • Add and remove moderators
  • Create new posts and comments

You can get started now by installing the module through the PowerShell gallery.

Install-Module Lemmy-preview
Import-Module Lemmy-preview

If you are not familiar with PowerShell, I've include detailed instruction in the GitHub repo with lots of example. https://github.com/mdowst/Lemmy-PowerShell

If you run into any issues please let me know either here or by submitting an Issue to the repo.

73
 
 

cross-posted from: https://programming.dev/post/183868

posh-git is a PowerShell module that integrates Git and PowerShell by providing Git status summary information that can be displayed in the PowerShell prompt, e.g.:

example

74
75
 
 

What happens to PowerShell scripts using Azure AD, Azure AD-Preview, or MS Online modules on June 30, 2023?

There will be no impact to PowerShell scripts using these legacy modules on or after June 30, 2023. They will continue to function and be supported until deprecation announcement.

What happens to PowerShell scripts using Azure AD, Azure AD-Preview, or MS Online modules after March 30, 2024?

We plan to deprecate Azure AD, Azure AD-Preview, and MS Online PowerShell modules on March 30, 2024. After this date, the only support offered for these PowerShell modules will be support in migrating to Microsoft Graph PowerShell SDK. Only security fixes will be offered for these PowerShell modules after deprecation is announced. Once these modules are deprecated, they will continue to work for a minimum of six (6) months before being retired.

view more: ‹ prev next ›