![Community banner](https://programming.dev/pictrs/image/f4fbe1e0-3704-470f-9727-e67487cd1268.png)
![powershell](https://programming.dev/pictrs/image/329c1c67-6914-4ccf-8a7d-89ea3e07b435.png?format=webp&thumbnail=48)
Powershell
- I haven't seen a [#PowerShell](https://fosstodon.org/tags/PowerShell) [#Podcast](https://fosstodon.org/tags/Podcast) account in the fediverse, but I talked to them anyway 😉
I haven't seen a #PowerShell #Podcast account in the fediverse, but I talked to them anyway 😉
- Display Profile Functions [OC]www.dowst.dev Display Profile Functions
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 dis…
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.
- Guidance on developing locally with Azure Automation
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!
- Check your Azure Automation Accounts for Run As accounts before they are retired on Sept 30gist.github.com This script contains functions to help you identify potential runbooks still using Run As accounts.
This script contains functions to help you identify potential runbooks still using Run As accounts. - Find-AutomationRunAsAccounts.ps1
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.
- Using Enums in PowerShell
Enums were introduced to PowerShell in version 5.0 and can be used as a simple way to validate script and parameter input.
- How to create PowerShell docs
Go beyond comment-based help. Bring your own module and learn how to create the documentation to support it.
- PowerShell Weekly for August 11, 2023
Announcements!
- Desired State Configuration (DSC) Planning Update \ A fun and informative blog post sharing the exciting plans and roadmap for Desired State Configuration (DSC), including plans for compatibility, transparency, cross-platform support, and more.
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
- Unlocking PowerShell Magic: Different Approach to Creating ‘Empty’ PSCustomObjects \ Today I saw an article from Christian Ritter, "PowerShell: Creating an "empty" PSCustomObject" on X that got me curious. Do people create empty objects like Christian proposes? I want to offer an alternative to Christian's article, which uses OrderedDictionary and converts to PSCustomObject.
- Simplifying Creation of Empty PowerShell PSCustomObjects using Custom Functions \ Creating an empty PSCustomObject in PowerShell is a common task, but the traditional approach can be verbose and repetitive. In this blog post, I'll walk you through a more structured and efficient way to achieve this using functions and property definitions.
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.
- PowerShell Weekly for August 4, 2023
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
- Programmatically generate resource names with Bicep and Azure Naming Tool V2 \ RIf you’ve ever found yourself exhausted from manually using the aznaming tool through the UI to generate resource names, fret not! I’ve been there, and...
- PowerShell: Report On-Premises Active Directory Accounts that are Synchronized with Azure AD Connect \ Organizations that subscribe to Microsoft 365 and also have on-premises IT infrastructure, tend to synchronize accounts from their local Active
- Text 2 Video Narrator \ This PowerShell script allows you to create videos from specially formatted text files using Amazon Polly for text-to-speech conversion. The script reads the input text file, generates PowerPoint slides with appropriate content, and then exports them as video files. The process involves the use of AWS Polly for voice synthesis and the AWS CLI configured with a user having rights to Polly.
- One-Liner Wednesday August 2, 2023 \ Have you ever needed to create multiple 365 Groups/Security/Distribution at one time?
- Powershell Scripts for Hackers and Pentesters \ Basic of Windows Systems (history, methods , tricks) Windows Pentest Methods, Common ports/services, Basic commands Scipts (Ping-Play, Enumeration, Silent Installer) and more
- Azure Blob Storage Archive and Rehydration Management \ I've developed a PowerShell Module for managing the rehydration process of archived blobs in Azure. This script allows you to verify the status of blobs listed in a given file, determine whether they are in an 'Archive' state, and provides visibility on their rehydration status.
- PowerBits \ A collection of useful, time-saving tools for working with Microsoft Power BI
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
- Experts Line Australia \ September 19-20 - Early bird pricing ends Aug 9th
Check out psweekly.dowst.dev for all past editions as well as a searchable archive.
- PowerShell Weekly for July 28, 2023
Blogs, Articles, and Posts
- Reconnecting Pages with Language Variations After Copying Them with ShareGate \ Have you ever copied pages with language variations using ShareGate and ended up with a mess? Don’t worry, check out my blog post to learn how to reconnect your pages with PowerShell in a snap.
- Microsoft Office 365: How to disable the automatic creation of Online Meetings in Outlook \ In this blog post I will show how to disable the automatic creation of an online meeting in Outlook. The default behavior is the following:
- Check if TPM chip is present and enabled and retrieve version with PowerShell \ A Trusted Platform Module (TPM) chip is a specialized hardware component that provides security-related functions and serves as a secure root of trust for a computing system. It is a microcontroller that is integrated into a computer’s motherboard or added as a discrete component.
- PowerShell Out-ConsoleGridView and F7History \ I saw these two console tools for PowerShell in my newsfeed, and I like them :) This blog post will show you what they are and how they work.
- Automate Backups for Azure Table Storage with Azure Function App \ If you’ve ever used Azure Table Storage you’ve probably wondered – where is the backup option?!! I mean, you can back up SQL server or NoSQL databases, and you can back up storage blobs and Azure files, so why not table storage? Microsoft do not provide any native backup solution for Azure table storage
- 10 Popular PowerShell Tips and Tricks in 2023 \ This midyear roundup of our most-read PowerShell articles contains tutorials and best practices.
- Implementing a Code Search: Indexing Git Repositories using PowerShell (Part 2) \ This article shows how to use Elasticsearch and ASP.NET Core to implement a Code Search Service.
Projects, Scripts, and Modules
- One-Liner Wednesday July 26, 2023 \ Ever needed to check a computer or server and see how much disk space is being used?
- Orchestrating 1Password with PowerShell \ Over two years ago I authored a PowerShell Module that enabled the automation of 1Password. I created the module because I wanted to be able to:
- Unveiling a new version of M365Documentation PowerShell Module: Creating Markdown Documentation with Ease \ The Microsoft 365 community has a reason to rejoice as a new release of the M365Documentation PowerShell module was published PowerShellGallery.com. With the latest update, users can now create comprehensive documentation in Markdown format, complete with an intuitive table of contents. This feature has been highly anticipated and requested by Read more
- PS Protector: PowerShell Module Builder \ PS Protector is a small Windows utility that simplifies converting your PowerShell .psm module file(s) into Windows .NET dynamic-link library (DLL) assemblies.
Books, Media, and Learning Resources
- PowerShell Automation and Scripting for CyberSecurity: Hacking and Defense for Red and Blue Teamers \ Take your cybersecurity skills to the next level with this comprehensive guide to PowerShell security! Whether you're a red or blue teamer, you'll gain a deep understanding of PowerShell's security capabilities and how to use them.
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.
- Powershell 7 installed on machines in your environment or not?
Like the title says. Have you got powershell 7 installed on the machines you connect to or not?
- mikefrobbins.com How to configure Azure PowerShell global settings with the *-AzConfig cmdlets
This article is a brief introduction designed to raise awareness about the *-AzConfig cmdlets in Azure PowerShell. These cmdlets, introduced in the Az …
- All sessions from the PowerShell + DevOps Global Summit 2023 are now available on YouTube
YouTube Video
Click to view this content.
- Drive Rapid PowerShell Adoption Using Jupyter Notebooks
YouTube Video
Click to view this content.
- [Script Sharing] My script to gather DMARC info from an O365 mailbox
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
- Moderate your Lemmy Community with PowerShellgithub.com GitHub - mdowst/Lemmy-PowerShell: A PowerShell module for interacting with Lemmy
A PowerShell module for interacting with Lemmy. Contribute to mdowst/Lemmy-PowerShell development by creating an account on GitHub.
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.
- posh-git: A PowerShell environment for Gitgithub.com GitHub - dahlbyk/posh-git: A PowerShell environment for Git
A PowerShell environment for Git. Contribute to dahlbyk/posh-git development by creating an account on GitHub.
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
- Azure AD Graph Retirement and PowerShell Module Deprecation Updatestechcommunity.microsoft.com Important: Azure AD Graph Retirement and Powershell Module Deprecation
Important updates on Azure AD Graph and PowerShell module timeline and future.
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.
- Who are some users that write really awesome PowerShell code?
I've been writing PowerShell code for almost 10 years now, and I love it when I come across someone who uses interesting techniques and patterns that I haven't seen before.
Do any of you have a list of users in the community from which you've taken inspiration in your own code? Who are they? I'd like to follow them :-)
- PowerShell Weekly for June 16, 2023 [OC]
PowerShell Weekly is a hand curated list of PowerShell news, blogs, scripts, etc. that I discover each week and feel are worth passing on. In other words it is not just me reporting everything with a PowerShell hashtag.
There is nothing to sign-up for and there are no ads. It's just my little way of giving back to the community. I also do not accept any sponsored content, but I do take recommendations and suggestions from the community, so feel free to send things my way.
I try to get it published by 9 am US central time (2 pm UTC) each and every Friday. (Expect for the week between Christmas and New Years, I give myself that week off)
It has been going strong for 4 years now and the entire back catalog is searchable and tagged with categories, authors, and timeframes.
- c/PowerShell Community Feedback
I want to make this a place that everyone can get the most out of. So, I've been working on a list of guidelines/rules for this community. Instead of just posting them in the sidebar, I thought I would post my proposed rules here first to provide everyone a change to provide feedback.
So, please let me know if you have any thoughts or suggestions.
---
Rules:
- Be civil (aka don’t be a jerk). Remember there are people from all walks of life, all with different levels of expertise. You can disagree with someone, but please be civil when doing so.
- Adhere to the Lemmy Code of Conduct
- Follow all programming.dev rules
- Posts must relate to PowerShell or the PowerShell ecosystem.
- Use code blocks to make things easier to read.
- Memes and humorous posts are allowed but try not over do it. And keep them relevant to PowerShell
- No discussion about piracy or hacking.
- If someone provides an answer that solves your problem, please reply, so others know what the solution was. And so the person who suggested it gets that oh so sweet shot of dopamine.
- If you find a solution to your problem by other means, please take your time to write down the steps you used to solve your problem in the original post. You can potentially help others having the same problem!
Self-promotion rules:
- Self-promotion content must be marked as [OC]
- Do not SPAM. Content must be PowerShell related.
- Only 10% of your contributions can be self-promotion. In other words, 90% of your contribution must not be self-promotion.
- Personal blogs are not considered self-promotion, at this time, as long as they are free to access and relevant. Please do not abuse this.
---
Also, let me know if you are interested in helping moderate this community.
- PSResourceGet Preview is Now Availabledevblogs.microsoft.com PSResourceGet Preview is Now Available - PowerShell Team
Microsoft.PowerShell.PSResourceGet is a continuation of the PowerShellGet 3.0 project. The first preview release of this module under the new name is now available on the PowerShell Gallery. This release contains the module rename, and reintroduces support for Azure Artifacts, GitHub packages,
tl;dr the upcoming replacement for PowerShellGet
- Display Any Tree with PowerShellitluke.online Display any tree with PowerShell
Display Active Directory, Registry, VMWare, File System, and more trees with PowerShell…
Not OC
- PowerShell Community Call Archive
To kick off the new community here is a link to the month PowerShell call and the archive of past calls.
- Welcome to c/powershell
Come in, introduce yourself, and say hello to others. Hoping to build a friendly and helpful community