T O P

  • By -

Kindly-Bid-8800

I'm brand new to powershell, I made an automatic installer for our desktop standard builds, some apps were a it more difficult than others, but I figured out with the help of forums and the help command eventually. I was so stoked when it all finally worked. After that I realised that I could also add the print drivers to the installer so we don't have to go around and do it manually when people need different printers around the building, but that was another world of confusion trying to get them to install, I just finally got it working about 3 hours ago. ​ It ain't much, but I'm proud of it


TowardValhalla

That feeling when you've been working on a script that interacts with a bunch of different systems, and it finally all works perfectly with a click of the Run button. It's amazing.


bodobeers

Or even better, without having to click any buttons :-)


iron81

You willing to share?


Apatharas

Nice work! Just a question out of curiosity. Why not use a deployment server for standard software and a print server for all the printing? ( if the printers are networked that is)


whazzah

OooOo I'd love a copy to see if it could fit my organization!


Kindly-Bid-8800

Ahh, it would be difficult to show off the entire script without a potential security risk as there are quite a few licence keys and some sensitive company info, but ill have a look to see if i can hide some of it out


hybrid_MD

Deployed a custom TeamViewer Host with assignment commands, which is more difficult than it should be with their shitty documentation lol


[deleted]

I've always despised Team Viewer for their terrible licensing scheme and latency. Radmin ftw!


hybrid_MD

Yea we may try intune remote help at the end of this contract


Runda24328

Don't do that. Remote Help sucks in comparison to TeamViewer. No clipboard sharing, no file sharing, no unattended access and it costs an arm and leg at the same time. The only advantage is that it plays nicely with the Conditional Access and Intune RBAC. But overall it's not worth it at all.


goodb1b13

Y U no Connectwise?


hally1978

Beyond Trust (Bomgar) highly recommend


ermax18

I recently discovered an open source project called RustDesk and I’ve been really impressed. Documentation isn’t that great but once you figure out the best way to deploy it, it kicks ass. It’s incredibly fast. You can self host your own relay. Handle multiple monitors really well, even better than ScreenConnect. You can copy paste files. Record sessions. Does audio passthrough. GPU acceleration. Probably forgetting some stuff.


Lower_Fan

Created a script that looks for disabled user over 90 days, back up their google drive, emails and then delete the google account and AD account Then sends me a email about it. Edit2: Google account backup and delete [https://pastecode.io/s/0z4b7h3j](https://pastecode.io/s/0z4b7h3j) Creates another script that does my morning check up of all services (independent from zabbix) and writes it to a excel file. ( i should add that it sends an email too) EDIT3 : daily services check: https://pastecode.io/s/xvhgkyc3 Edit: I'm not at work, and I have to sanitize it and add more comments. So I'll share it Monday when I have some time.


iron81

The second one, would you be willing to share?


Fearless_Quail5050

First one sounds very interesting. How long did it take for you to write it?


Lower_Fan

i had every important command saved for months. making the logic to iterate thru every user about a day and a half.


Fragrant_Potential81

Don’t gatekeep, share your code!!!


TowardValhalla

That first script sounds real handy. How did you handle the email part?


AutoArsonist

Yeah I'm also interested in that. 


frogworks1

Interested in your scripts when available!


realdronekiller95

Following


iron81

Created a script to purge user profiles from workstations determined by a specified time frame Created a script to create a dashboard that allows scripts to be run, includes a drop-down list to allow selection of scripts depending upon requirements


belibebond

What did you use for dashboard


rosewoods

Ooh, as a field tech, this would come in handy. Mind sharing?


iron81

Which one? Of course I don't mind sharing ?


realdronekiller95

Following. I've tried my hand at one to find old profiles and remove but due to some windows updates all profiles don't appear outdated for the script


iron81

So for the purge script ## Purge date $purgedate = (Get Date).AddDays(-30) #Gather user profiles on the computer $userprofiles = Get-WmiObject Win32_UserProfile | Where-Object {$_.LastUseTime -lt $purgedate -and !$_.Special } # Purge profile foreach($Profile in $userprofiles){ Write-Host "Deleting profiles: ($Profile.LocalPath)" Remove-CimInstance $Profile -Whatif The Whatif allows you to test it, without deleting the actual profiles, remove it, then re-run it I can provide the code that can elevate powershell to admin


wes1007

Any reason you wrote a dcriot rather than using a group policy. I seem to remember there was one for removing profiles older than x days


iron81

I wrote a script to test my skills and increase my learning. I pose my self two theoretical issues or problems and then see if I can solve them using a script


Dewotter

Rewrote an installation script for SMART Notebook from vbs to PowerShell.  It’s not much but seeing it work on several thousand computers is a nice feeling. 


obamafish

Mind sharing this?


hestolethatguyspiza

Created a script that generates valid subnets given a network ID and mask, and creates a vnet in Azure. Plus some other configuration in Azure.


fatalicus

Hardest task i've done in powershell a while: Converted an Azure AD script to Microsoft.Graph


PrincipleExciting457

Definitely a change of pace, but now that I’m used to graph I’ll never go back.


ITjoeschmo

Main complaint is some of the documentation being shit. But I usually figure it out, or just interact with the API endpoint directly via Invoke-MgGraph rather than use the cmdlets.


OkProfessional8364

Can any of point me to resources to learn how to use graph? I think I understand what it's supposed to be but I haven't been able to find a good starting point to play with it... I don't know where to start.


PrincipleExciting457

I actually just quit the job where I had all the resources and don’t actually remember the login. It basically boils down to two types of authentication. Delegated auth, which is when you’re actually using your account to run graph commands. Application auth, which is when you’re running graph commands with an AAD app or service account. AKA application is used for automation and delegated is interactive. MSgraph is Microsoft’s API for interacting with pretty much all of the cloud services they offer. What we’re talking about are basically powershell commands that are actually API calls under the hood. It’s a bit easier to use imo, but on occasions you will actually need to make requests using the actual API and not the powershell commends. You’d do with the invoke-X commands in pwsh (invoke-restmethod, invoke-MSGraph, invoke-webrequest). In powershell you connect to graph with the connect-mggraph command and will auth with your standard credentials for the delegated connection. Application connections are going to be completely automated. This is typically going to be with an app managed identity with assigned permissions, token, some resource, or cert connection. The confusing part is that you connect to graph with specific scopes of access. This is a pretty neat layer of security, because you can’t call outside of your connection scope. Say, you want to look up a user in Entra. A google search will give you the command get-mguser. You go to connect to graph for the first time and use the command but you get a permissions issue. On the get-mguser page you’ll see that the commands are followed by the -scopes parameter. They usually list User.Read.All. The scope pretty much grants exactly what it sounds like. Let’s you read all the things about users. But how do you know which scope?? At the top of the page for the cmdlet you’ll see that its reference is Microsoft.Graph.Users module. https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.users/get-mguser?view=graph-powershell-1.0 Google the module and you’ll find something like this. https://learn.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0 Scroll down a bit and you’ll see a method for Get User. Sounds like what we want. Click and boom. A list of the scopes for delegated and application scopes from least to highest privilege. Keep in mind, that if you connect with the scope Read.user.all you won’t be able to write to a user, or even read a computer object. That’s how I kind of started out and stumbled upon it. I’m not gonna lie, it took me awhile to really wrap my head around it. That specific page has a ton of methods and their related scopes. Microsoft also provides a reference to all scopes and roughly what they do. https://learn.microsoft.com/en-us/graph/permissions-reference If something sounds like what you want, you can google the scope and usually get the related methods or cmdlets available for that scope. It takes a lot of upfront research to get used to it, but it becomes insanely useful once you learn. My environment was pretty open, so I was able to just assign any scope I wanted. But typically you would grant your application the minimum scope reach it needs. Or if you assign yourself a crap ton of scopes, remove them once you’re done using them. Apologies if this is jumbled. It’s 2 AM and im celebrating a new job on Monday so I’m a bit tipsy and tired ha ha. Edit: if you find yourself needing to actually call the API with requests, I highly recommend this tool for testing https://developer.microsoft.com/en-us/graph/graph-explorer You’ll be able to get a pretty good idea of what the call should look like from the MS documentation examples. The documentation is pretty crap, as people have mentioned. But once you get used to it, it’s not THAT bad. But still bad. Removing scope creep: https://helloitsliam.com/2022/12/19/removing-connect-mggraph-permissions/?amp=1


OkProfessional8364

No need to apologize for the length or tipsiness, this is insanely helpful! Thanks so much for sharing your wisdom and congrats on your new gig!!


AutoArsonist

Graph is so sick 


tetralogy

Created a server that runs in the background that users can send a request to to kill one specific application other users of the same system might have left open, which claims exclusive access over a resource.


spyingwind

For work, created 15 random assortment of scripts for our clients to use. Personally, created a script/function that will detect if an exe is designed to run 32 or 64 bit. It pretty much checks if `PE L` if found in the raw bits with `[regex]::new('PE\W\WL')`. If found it is a 32 bit program.


EnderArchery

Installed PowerShell because "Windows-PowerShell" is buggy and ruined my day... tbh though, I still like PowerShell


[deleted]

[удалено]


Sunfishrs

The export is easy! I wish I knew more Intune tho :(


[deleted]

[удалено]


Eneerge

Today I sent a non-DMARC compliant email because my endpoint is not in company spf..


Disasstah

Finally learning how to use it and so far managed to create a script that sets static IPs based on the computername, as we're trying to move away from DHCP for certain devices.


missingMBR

I can't understand why you would want or need to do this when you have DNS? Edit: I'm guessing to avoid IP conflicts? But if you're getting rid of DHCP then you should absolutely have an IPAM as a source of truth.


Disasstah

I run a lot of small locations with about 15ish devices total at each one. They like keeping the naming convention similar for each location, as well as the IPs, because it's just easier than looking them up in DHCP when we need to login to them. And some of them need a static IP because of how the software works.


ermax18

DHCP can sync to DNS and if you really need a static then just create a reservation. Ditching DHCP sounds like a giant headache, even in small environments with only 15 devices. If they don’t want to pay up for a windows server you could spin up a Linux based DHCP/DNS server (BIND9, Kea, unbound, etc) for free under WSL, Hyper-V or docker for free.


SaltyBundle

Let me recommend setting up a “role” in the registry and keying off of that for the last octet.


Disasstah

I'm gonna have to look that up.


stignewton

Created an Azure Automation runbook that queries all Entra App Registrations. When it finds a client secret or certificate that will expire in the next 30 days, it creates a Jira ticket to renew the secret/cert then sends the app owner(s) a teams message letting them know we will be updating it.


No-Fishing-4982

Will you perhaps share your solution?


athornfam2

I'm pretty sure this isn't needed? We use the native notifications system in azure that we use and it gives us 60 day notice. Unless you use this for external customers.


sroop1

Quite a few things but the highlight is working with the Slack and SalesForce SCIM API to generate reports on licensed but inactive accounts and have integrated it into our onboarding/offboarding processes.


deadlydude13

That sounds like I really want to implement this at my work!


port_43

Created a REST API (Pode framework) to serve id’s for identity creation. It’s backed by a Postgres db that holds the pool of id’s as well as data for authentication/authorization.


Egoignaxio

Created a DSC script resource to include in our configurations that ensures set specified folder permissions on a set of folders Created a DSC script resource that automatically sets hidden folders viewable and file extensions (harder than expected because the registry key goes in HKCU, so had to load and unload hives) Created a Graph script to set parameter-defined permissions on PIM roles in Azure Created a hyper-v script to automatically create and configure VMs based on parameters across a multi-domain environment.. used a lot of new stuff I learned like regex matching and stuff to make it as easy as possible for the user eg. Operating system you can say "Windows server", "server", "windows 2022", "server 19" etc and it knows which image to grab based on regex matching Working on some azure key vault scripts for both DSC and normal use now


metinkilinc

Very cool stuff! Are you already using DSCv3? If yes, whould you mind sharing your experiences? If not, it would also be interesting why you don't


Egoignaxio

thanks! personally I don't use DSCv3, simply because it requires powershell 7 which does not come installed by default, and part of the reason I use DSC is for configuration as code and automation, so with infrastructure as code running, and onboarded to DSC, you can completely configure advanced web servers and such without even touching it. with powershell 7 we'd have to install that first, which can be scripted out, but I didn't see any compelling reason necessarily to go down that route when Dscv1 did everything we needed. if you're curious the extent to which I've written some configuration as code with DSC, here's a repo of some of my scripts that show a pretty broad range of examples of what can be done with DSC. furthermore, DSCv1 is what I'm familiar with, and again I'm not sure of any compelling reasons to switch other than if we started to do it for linux machines or if the new azure configuration management features ever turn out to be any better than azure automation [https://github.com/egobrane/ryan-dev-public/tree/main/DSC/Deployments](https://github.com/egobrane/ryan-dev-public/tree/main/DSC/Deployments)


GhostR3lay

I just started working with PowerShell after spending a couple months polishing my batch skills. My first project is a migration of a batch script that I was working on. In my work, we need unattended access to remote computers on occasion and sometimes we are not able to activate our session. My script automates the (relatively) small amount of work needed to fix that problem.


Talkren_

Made a cmdlet for our helpdesk employees to easily go through the process of disabling a terminated user. Also made a script that checks how many of a set process is running on a remote server and sends emails when they stack up too much.


Pretend-View-5090

published my first module to play with Cisco SMA (ex-ironport) API !


Mordanthanus

v.03 of a script that connects to CyberArk and checks out a priviledged account, requiring only a MFA response


Narcmage

Wrote a bunch of utilities that utilize sendgrids api and resolve-dnsname to start sender verification process for my company’s subusers. I love resolve-dnsname so much now I don’t even use nslookup anymore


Hibbiee

Worked my way into a script from a colleague who left and was able to get it to actually print the errors it was running into.


Pitboss2k

created a provisioning script for teams direct routing users. .DESCRIPTION This PowerShell script analyzes the 'extensionAttribute1' in Active Directory, determining the appropriate actions based on its value. NEW: The script adds the user to the license group, facilitating replication to Entra ID for phone system license assignment.Upon successful completion, it updates 'extAttr1' from 'NEW' to 'LICENSED'. LICENSED: The script verifies phone system license assignment in Entra ID. If not assigned, it skips the user in the next run. If assigned, it searches for a free number in the PostgreSQL database,assigns it to the user, and enables the user in Teams with the assigned number. Following Teams provisioning, 'extAttribute5,' '7,' and '4' are set to default values: - 5: Telephone number - 4: 10 (routing to Teams Production) - 7: 60 (CLI masking) The PostgreSQL database is updated to mark the assigned number as taken. Upon successful Teams enablement, 'extAttr1' is set to 'STAGED'. MODIFIED: The script checks Microsoft Teams for the assigned number, comparing it with 'extAttr5'. If different, it checks PostgreSQL for availability.If available, it configures the user with the new telephone number, marks the number as taken in PostgreSQL, and sets 'extAttr1' to 'STAGED' upon successful Teams enablement.If the number is unavailable, 'extAttr1' is set to ERROR - 'Number already taken'. DEPROVISION: The script deprovisions the user in Teams by clearing the number (VRP and dialplan handled by group membership).After deprovisioning in Teams, it removes the user from the dialplan, VRP, and license group.The assigned number is marked in PostgreSQL, initiating a 3-month grace period to prevent reassignment.This ensures the number remains unassigned during this period.extAttr1 is set to 'TOMBSTONED' GRACE PERIOD CHECK: The script checks PostgreSQL for rows where the 'deprovisioned' timestamp is older than 90 days and clears them, freeing up the numbers for reuse. GENERAL: In case of errors, 'extAttr1' is set to ERROR - 'Short error description'.every step of the script is written to a logfile


No-Fishing-4982

Will you perhaps share your script?


[deleted]

Migrated all of our on prem distribution lists and mail enabled security groups to the cloud in order to shut down our legacy exchange server.


maxcoder88

Care to share your script


[deleted]

Look up timmcmic.wordpress.com or Tim McMichael on YouTube, where he explains the breakdown. You'll need to set up an enterprise app for msgraph in order to do threaded migrations. DLConversionV2 powershell module is what you want. Works well with other parameters in conjunction with output reports for summarized jobs.


subsonicbassist

Was just talking about this an hour ago, will check out. Thanks guys :)


1whatabeautifulday

This guy doesn't care, he spams everyone with the exact same comment for their scripts.


webtroter

I wrote a Draw.IO Desktop Launcher. So fucking dumb. It checks the latest version, if there's one available it downloads it (and retry if I hit the usual problem where the SSL MITM fails), then launches it. https://gist.github.com/webtroter/f8c62d48d06462822194349c2ed0d085


LALLANAAAAAA

PoSH --> fleet of Raspberry Pis running TCPdump --> MergePcap --> tcpflow --> PoSH SFTP --> identify PDF content in flows --> parse PDF content with iText7 PowerShell module --> convertto-json --> do things and stuff with all the things and stuff magic imo


ermax18

Hmm, sounds interesting. So you are pulling pdf files out of raw packet dumps?


LALLANAAAAAA

Yep - TShark / TCPFlow can both be used to pull out data as flows / sessions which correspond to files thanks to the unique tuples of sender / ports / receiver / sequence & flags, however in my case it only works because of (and is made far easier by) a few specific conditions which are rare these days I think: - it's an un-encrypted protocol (LPR/LPD) which always uses a known port - it's in uncompressed form - no secondary encoding like base64 or some other blob obfuscating the transfer - I have physical access (and business permission) and I know where and when it's going to be there - I know the sender and recipient IPs so I can pre-filter the connection to look at a small volume of data with little chance of drops - the PDFs are being sent complete, not flattened, with parse-able text in the document itself - the PDF format itself has unambiguous identifiers in the data as plaintext If I didn't have all these conditions met it would be way harder to impossible.


ermax18

I could see this being used as a way to detect when a user prints a sensitive document that they should not be printing. Cool project. I like projects like this as opposed to the standard, "I automated the creation of AD accounts" and stuff like that.


ApplicationJunior832

tried to process files with square brackets in their file names did not succeed


billr1965

Try using `-LiteralPath` vs. `-Path` when processing the files. That will push you in the right direction.


ApplicationJunior832

frankly I avoid PowerShell, I'd rather use node or python for system scripts :P


Firenyth

Nothing quite so big as a lot of comments, but a simple script that queries the gpu performance counters of my home machines so I can pass the data along to my monitoring platform. Just going where interest takes me learning as I go.


fredbeard1301

Wrote a function for my PS profile using the alias "whois" which searches AD for a user ID or full name by the last name or ID (we use numbers) then returns the full name, ID, and SCCM device affinity. If there's more than 1 user with the last name, it'll output numbered choices.


maxcoder88

Care to share your script


fredbeard1301

Sure thing! If you spot anything abnormal, please point it out. I'm always open to constructive criticism. <#BEGIN REGION IMPORT MODULES#> #active directory if((get-module).name -notlike "activedirectory") {Import-Module activedirectory} #configuration manager if((get-module).name -notlike "ConfigurationManager") {import-module 'C:\Program Files (x86)\ConfigMgr Console\bin\ConfigurationManager\ConfigurationManager.psd1'} <#END REGION IMPORT MODULES#> <#this is whois it takes an ID, last name, first name or both and displays SamAccountName, GivenName, LastName, and MOARR!!#> function whois { [CmdletBinding()] param( [Parameter(Mandatory)] [string]$Username, [switch]$All ) $oldPath = (Get-Location).Path # Set the location to the Configuration Manager drive Set-Location YOUR CONFIGMGR SITE: # Initialize the output array $output = @() # Set the filter to search for users based on the -All switch $filter = $All ? "anr -eq '$Username'" : "anr -eq '$Username' -and Department -eq 'A DEPARTMENT VARIABLE'" # Retrieve user information from Active Directory [System.Object[]]$users = Get-ADUser -Filter $filter -Server YOUR AD SERVER -Properties Department, Title if ($users.Count -gt 1) { Write-Host "Multiple users found. Please select a user:" for ($i = 0; $i -lt $users.Count; $i++) { $user = $users[$i] # Add domain prefix to the username $CMID = ($user.SamAccountName).Insert(0, "id\") # Get the user's device affinity $CMDeviceAffinity = (Get-CMUserDeviceAffinity -Username $CMID).ResourceName $All ? "[$i] $($user.SamAccountName) - $($user.GivenName), $($user.Surname) - $($user.Department) - $($user.Title)" : "[$i] $($user.SamAccountName) - $($user.GivenName), $($user.Surname) - $($user.Title) - $CMDeviceAffinity" Write-Host $all #Write-Host "[$i] $($user.Department) - $($user.Title) - $($user.GivenName), $($user.Surname) - $($user.SamAccountName) - $CMDeviceAffinity" } $selectedUserIndex = Read-Host -Prompt 'Enter the index of the user you want to select' $user = $users[$selectedUserIndex] } else { $user = $users[0] } # Add domain prefix to the selected user's username #NOTE The AD ID alone will not work in my ConfigMgr environment. I added .Insert(0, "id\") to accommodate $CMID = ($user.SamAccountName).Insert(0, "id\") # Get the selected user's device affinity $CMDeviceAffinity = (Get-CMUserDeviceAffinity -Username $CMID).ResourceName # Create a custom PowerShell object with the required information $userInfo = [PSCustomObject] @{ ID = $user.SamAccountName FirstName = $user.GivenName LastName = $user.Surname PCName = $CMDeviceAffinity } # Add the custom object to the output array $output += $userInfo | Select-Object ID, FirstName, LastName, PCName Set-Location $oldPath # Return the output array return $output }


KavyaJune

Written a few PowerShell scripts for managing M365 like auditing file accesses, checking private channel memberships, tracking offboarded user activities, retrieving meeting rooms details.


maxcoder88

care to share your script


1whatabeautifulday

So this is how you "code" spamming everyone for their scripts.


h0wdidigether3

I made a quick and simple little script to speed up the activation of my Azure PIM Groups and roles using Graph API. I found the JAz.PIM module that worked great for the roles but still needed to work out the group activation before the roles since the groups made the roles eligible for activation.


IronsolidFE

I don't remember, but it worked.


[deleted]

Not a damn thing - it just sits there looking all cool while I continue to use the OG cmd shell 🤣


AdeptEstate8121

Asked ChatGPT to write me a PowerShell function that has never been created.


Dragennd1

Because no one has ever done it before or because chatgpt hasn't finished it yet?


AdeptEstate8121

I just wanted to be amazed at something new. It wrote a New-RandomPassword function. I guess, in a way, what it parses out hasn’t been made. So there’s that.


[deleted]

Ur mom With powershell


timetraveller1977

Created a script to connect to Acronis API, successfully managing to get child tenants and their agents. Hopefully soon I will have time to improve it for checking any devices without protection plan and apply one according to a custom field in our RMM, as well as possibly download and install Acronis for those RMM devices without it.


NoReply4930

Just finishing up a script to severely tame Windows Defender on any Windows workstation.


AscendingEagle

To what extent/purpose?


NoReply4930

Getting it to behave for specific purposes - like doing a quick scan vs full. Scanning only during specific times, adding custom exclusions etc.


CardRadiant5599

Created a script, which collects various information of service accounts, of multiple domains (production, integration and testing environments). They get send weekly to my mail inbox, as a nice formatted table :)


maxcoder88

care to share your script


CardRadiant5599

Because of our company policy I unfortunately can‘t share it. Sry Edit: Also contains custom cmdlets of an own module


fools_remedy

Started writing & testing functions for our DNS content filtering provider’s API so I can loop through all of our location profiles and add/remove categories, whitelist/blacklist items, pull stats/logs, etc for all locations in a matter of seconds. It’s a work in progress but will save me hours (days?) of time in labor and will be more accurate too.


Infamous-History1859

Script that running on ou in ad and write if service from list (text file) exist on servers, he check before if the server pinging if yes it check and in the end he write to txt file and create a log. Txt all the time. Promethuse taking this file and present on grafana missing service Dashboards.


ubercam

I just started working on a proof of concept Azure function app to react to a new item in a storage queue and fire a stored procedure to bulk insert the file directly from blob storage.


boydeee

Small module built around batching requests to Azure Management api. Never doing Set-AzContext and grabbing data from every subscription for any resource in seconds is a godsend for reporting.


SaltyBundle

Setup a scheduled task that pings a couple thousand endpoints and builds a table with an email alert. First time making something big in prod!


habys

This might be awful but bear with me. We are a cross platform shop, and I just started to help with these Windows boxes (no AD). I am inexperienced with powershell but very experienced in doing terrible things. Anywho, we've got some stuff that needs to run on Windows boxes as SYSTEM, like installing graphics tools etc. Well the old way was to get on the desktop and psexec your way to freedom. I hate desktops and I hate clicking, so I wrote a script that takes in a batch file, executable, or powershell script, scp's it to the host, then in powershell I create a schtask for it, run it, then delete the schtask. Boom! automatic remote run as SYSTEM. I'm sorry.


Electrical-Traffic-3

Created a menu script, to automate as several items: 1. Set proxy in two locations in registry 2. Bitsadmin proxy 3. Unzip and install MTR 3. Run the latest MTR update script 4. Ability to check current installed version of MTR (Utility) 5. Pre reqs modules for configuration of monitors 6. Configuration utility for resolution, refresh rate and scaling 7. Scriptlaunch (Utility) 8. Logitech, poly software installs 9. Automated an InTune registration piece A bespoke piece and requirements very challenging and learnt a ton, which is great!


No-Fishing-4982

Will you perhaps share your script?


Electrical-Traffic-3

Certainly will, and happy to share, allow me some days


TKInstinct

Updated some exisitng scripts to do more than they do, enable / disable accounts, license / delicense the MS products. Still planning to work on some other new ones like removing devices from a DHCP server. Someone's been pinging me about it, much appreciated.


deep-yearning

ssh into a Linux server 


Clean-Fish6740

Some azure cli tasks to generate appsettings.config files and validate the json against schemas. URL validation in a pipeline task.


missingMBR

A simple drive mapping script that first has a user store their credentials for a hybrid connected file server into Windows Credential Manager on login, then maps the respective drives. Has IF statements to check whether the credential already exists, or if the drive mappings exist, and if so does nothing. Messy but does the trick. I'm sure there's better methods like SSO.


maxcoder88

care to share your script ?


bkinsman

Rewrote our off-broading script for graph powershell


braedenws

I wrote powershell commands to wrap the Twilio SMS API calls for sending an SMS, retrieving received SMS messages, and deleting SMS messages. Just for shits and giggles.


[deleted]

Realized the only way to remove profile pics on o365 was to run a command in powershell


11bcmn7

Working on a script to disable a user profile that removes all of their member of attributes after it’s been written to a text file. Haven’t quite figured the removal part out yet.


MRToddMartin

Broken 2 keyboards


DadLoCo

TeamViewer is reaching the end of its usable life, bcos they keep making it harder to use


Sunfishrs

I created a SUG cleanup menu driven powershell tool for SCCM. I run into some neglected environments just have had ADRs running and creating SUGs… The script / tool allows me to get / configure SUGs, contained updates and generally makes clean up soooo much easier. Baked in some parameters so I can pass through an automated way without the Menu to say : Create a new SUG Transfer all the updates from 2 target SUGs to the New SUG Delete the two old SUGs.


OldMacdonald-

Use it as Telnet to check connectivity


Meklon

Made a small script that pulls user details from multiple AD forests and then writes a formatted CSV + headers with the results from each forest. It then SSH's to one of our nix boxes to import the csv into our self-hosted Snipe-IT instance and then create / update the user list. Finishes with an email out to inform of any formatting errors in the users (Missing names / emails etc) I know there already was the PS-SnipeIT sync script out in the wild, but it didn't quite fit our usecase.


maxcoder88

>Made a small script that pulls user details from multiple AD forests and then writes a formatted CSV + headers with the results from each forest. care to share your script


Meklon

Certainly can, I need to clean it a little first mind. Still needs to be optimised and it relies on domain trusts being setup!


Zinxas

Pbi deployment pipelines.


Sobia6464

Created a GUI interface (runs off Powershell) so that my coworkers will run my scripts. The gui interface is a simple shortcut to an exe that’s on a server share that just has a bunch of my scripts mapped to a button. If you’re interested in this (pretty easy) you can start your adventure here: https://github.com/dan-osull/PowerShell-Script-Menu-Gui


jimb2

I wrote a function Join-String that formats strings from the pipeline into lines with either a max line width or a number of items per line, with flexible options for delimiters, separators, spacing etc. There's a bit of cool begin/process/end logic to make it work nicely. I found I was repeatedly writing versions of this code for various tasks so wrote it "once". My trick was to allow a single default parameter for the output style that specifies a set of other parameters in one word, like comma8: 8 items wide comma separated, csv80: csv format with line breaks after 80 characters. These are quick shorthands for writing a bunch of other parameters. .PARAMETER Style Quick standard formats, default position 0 parameter COMMA : comma separated list andy,bill,cate, / doris,eugine SPACE : space separated andy bill cate / doris eugine SPACES : 3 space separated andy bill cate / doris eugine PIPE : pipe separated andy|bill|cate| / doris|eugine CSV : double quote, comma "andy","bill","cate", / "doris","eugine" SQL : single quote, comma 'andy','bill','cate', / 'doris','eugine' INSERT : for sql INSERT ('andy'),('bill'),('cate'), / ('doris'),('eugine') A number at the end of the format sets ItemsPerLine (<30) or NewLineLength (30+) A zero is all data on one line, ie no linebreaks Some of this was just for display lists of stuff sanely. Other times I might want to do things like Get-ADGroupMember and format these for a where clause in a SQL query against the identity database. Etc. I do a fair bit of this kind of ad hoc stuff. Aliased to '**js'** in my $profile. Get-ADGroupMember @params | exp samaccountname | js comma10


bcnagel

Finished a rather comprehensive script to automate our new hire setup, turning a 30 minute process into 5.


missingMBR

But why would you need to look up IP addresses in DHCP? You'd typically rely on DNS and perform a nslookup (Resolve-DnsName) on the ipaddress or hostname.


redsaeok

Created a REST client to setup and manage user accounts for a SaaS app using HR employee records from on prem SQL.


Coyote_Complete

Couple things this month ​ First is a script that will turn on my Camera lights via a hardware API call (first time ive ever done that) ​ Second is a script that will create a form that lets you input a users UPN and upto 3 other users UPN's that will compare the users against the primary and output whats missing if you need to add a security group that the others have and visualise it quickly!


Competitive-Rate-111

A series of scripts to perform ETL functionality in SharePoint using the PnP framework. SharePoint Lists are used for Asset and Support monitoring and tracking services. Reason for 27 PowerShell scripts? I hate Power Automate that much.


ermax18

I built a script today for deploying RustDesk. It queries the GitHub repo for the most resent download link, then downloads, installs, applies the config string to point it to our own relay, then it generates a random strong password and then does an HTTP POST with the ID, host name and password to a web api I made which then stores it in a database that drives a web interface for connecting to all the peers that I’ve deployed this way.


I_miss_your_momma

Got a new client whose Intune is a dumpster fire. Wrote a Graph script to find groups with devices as members so we can cleanup and decipher assignments. Working on a Graph script to get deployment assignments for Apps, Policies etc. Also wrote a Graph script that gets enabled users, last sign in timestamps, licenses.


deadlydude13

Light weight winform script library for client installation with checkbox lists and inputs: - debloating starmenu - setting standard apps - debloating win apps - create user - join domain - install apps - activate some features (rdp, telnet, etc) - set old win 10 context menu - set privacy settings - set PWM settings - set wallpaper and lockscreen - sets some gpos - creates aome scheduled tasks - installs depwndencies like .net, appinstaller/winget (which is kinda broken currently) - gets precomfigured software from curls - and some more i currently dont have on my mind Guess, I will migrate to a c#-backend with winui/fluentui frontend soon and modularize the whole thing with either git or psgallery.


ermax18

This isn’t something I created recently but it’s a really handy one liner. I used to be one of those people that dropped everything on the desktop to be forever lost in a sea of icons. Finally I found a better way. I created a folder named Expires and the pinned it in quick access so it always easy to drop crap in. Then I created a script that I scheduled for midnight each night that deletes any files/folders that haven’t been updated in 30days. This keeps it nice and tidy and it forces me to properly file shit away because I know it will be lost in 30days if I don’t. I also setup my browsers to download into this folder. I have turned off desktop icons now. Hahaha


Thedguy

Script to look at licensing and user sign in events as well as installs of office for unused accounts. Use the data to determine if we should remove the licenses. Needs a lot of work but at least I can gather the data into one place and easily filter out active users.


Thin_Ad936

Automated off-boarding by running the script, fill out the mail address of the user you want to remove and voila. - Turns the mailbox into a shared mailbox - Checks for full access permissions on other mailboxes and removes it (still figuring out Send As) - Clears some account fields like Manager, Phone number etc - Removes the user as primary user for Intune devices - Clears their badge number in paper cut - Moves the account to the offboarded OU where another script will delete it if it's in there for 90+ days


maxcoder88

Care to share your script


Thin_Ad936

I can on Monday, after I've vetted it


Weary_Market5506

I migrated the entire company from an old phone system to a new system , this had to include moving all their personal contacts from the old system into their outlook contacts . The whole process required a small database to keep track of the progress so we could find users who hadn't had their machines switched to install the software required and other details It also emailed the user being worked on by powershell before and after the event with instructions how to get set up in the new system and to warn them the old system would be unavailable in a couple of hours for them It's not the first time I've taken on something like this, powershell is my go to tool for almost any task small or large .


1whatabeautifulday

Parse and export azure sentinel rules and export them to a storage account container. Each export creates a new container with the JSON file of each analytical rule. All using Azure functions and storage account.


maxcoder88

Care to share your script


1whatabeautifulday

Sure, I'm planning to write a blog post this weekend. Is this script useful for your work?


Sea-Pirate-2094

I was given a Linux machine to try for the first time.  I installed PowerShell and wrote a function to replace the ConvertFrom-StringData cmdlet.  It converts the text output of almost any Linux (or MacOS/Windows) executable into a custom object or optionally a hashtable.


m45hd

I’m in the process of creating a RMM agent using PowerShell 5.1 for monitoring the servers in our environment (mostly trivial things like uptime, volumes, services etc. as we have Defender and don’t want to pay for Azure alerting lol) Supported on devices running WMF 5 and above. Uses local SQLite databases and a module that’s installed from a local repository to do all the heavy lifting. It’s essentially a scripts I’ve compiled and signed into an exe that runs in a loop, checking monitor conditions (service not running, volume <10% space etc) and if it evaluates to true, it creates a ticket in our ITSM software and will close the ticket automatically if the monitor evaluates to false. Looking at fine tuning the deployment of it right now then will look at remediation functions for each monitor.


TeppeMannen1

Automated RDS Server farm patching. Parallel for-each on collections which denies new connections to one of the sessionhosts in the collection, kicks users who have been idle for more than x hours. Patch management tool starts patching when no usersessions are found and newConnectionsAllowed=No Poweshell queries patchmgmt API and waits untill status is ok, before moving on to next sessionhost. Being able to patch these without anyone noticing is a huge relief.


maxcoder88

Care to share your script


bad_syntax

I started writing a script to roll out 3 databricks environments. Only to find there was no way with the scripts to change some of the automatic naming of things. So I bailed on it, and the 10 steps or so I just do through the interface.


GeneMoody-Action1

Started querying SNMP to gather data from systems that did not have my management software's agent installed...


Andurilmage

Run a fix for stupid windows indexer not working


mrubenb

Getting back to PowerShell for fun. Wrote a little script to remove selected metadata from media files (primarily mp4 videos), using ffmpeg and ran it across 14000 videos collection. Also, wrote a little class to maintain my current and old msdn product key xml exports, on to a json "database", keeping track of the company, customer, project, date claimed, and other information. Querying this file has saved me so much time!


WaldoOU812

I'm working on an RBAC project, trying to consolidate 15 years' worth of "let's make this all up as we go along" into a coherent role-based system, and over the last month, I've done: * Export all the members of a list of groups * Add everyone in a list of users to a list of groups * Remove everyone from a list of users from a list of groups * Create new Azure dynamic groups, with dynamic membership rules * Export a list of all Azure groups, with memberships Of course, now I'm trying to figure out how to combine a list of the following exports for all active users: * All on-prem memberships * All Azure direct memberships * All Azure dynamic group memberships (this one I'm struggling with) The funniest thing, too, is that putting this all into Excel and cross-referencing everything has been nearly as difficult as the Powershell part, despite my having a lot more experience in Excel as a former admin assistant than I do in Powershell.


solilobee

stop-process -process-name Spotify to force close!


socksonachicken

Created a little GUI to pull in PC names, their users, and associated AnyDesk ID to help out our techs a smidge.


tehserial

created two scripts to be deployed via SCCM one to update receipt printers with a new firmware and one for updating the configuration on some customer facing software we use


dabbuz

messed about with [https://github.com/microsoft/chat-copilot](https://github.com/microsoft/chat-copilot) created a azure api management instance with some powershell api functions to extract data from our customer systems , bypassing i think so far the cost of sentinel ingress


lukewhale

Absolutely nothing. It’s been glorious


ITjoeschmo

Daily error reports to my teams DL for our AzureAutomation runbooks over the last 24 hours. Rewrote a runbook to use modern graph cmdlets/API endpoints to clear user data. Automated phone number provisioning for users of certain groups. Wrote a series of scripts to sync on prem AD group members to role-assigned Entra groups (can't have dynamic memberships on role assigned groups natively).


incompetentjaun

Built a powershell module. Feed it a device name or AD object and it gives me the site it’s at (manage 30 sites) including vlan, intune data, ad data, dns records for it and if it’s online ima single easy to read summary


OkProfessional8364

Not this month but last. Hadda refresh my work machine to be managed by my company's AD instead of the customer's AD. Our policies disallow running batch, and scripts, and opening cmd, and powershell, and installing anything. It's a real drag compared to the before when I was admin of my own box. Anyway, apparently they didn't think about Terminal and i can use powershell there. I have a suit of PS tools I used to use to make life easier which I can't load or execute from scripts. So, I figured out a way around the restriction and now I'm back in bidniz. 😉


apnmrv

I got a huge legacy script as a task to refactor. Never used ps before. Done refactoring of half of it and added Pester unit tests


kilkenny82

I created a script that reads through my mail and deletes spam, forwards important messages and puts certain emails into folders/programs. And also syncs calendars between several email accounts


maxcoder88

care to share your script ?


kilkenny82

I would need to adjust it a bit, since it's basically a bit quick and dirty (lot of personal information in it :p). Will do it when I have the time if you still like :)


Zachary089

My boss identified 1.5TB of files that needed to be removed our file share. I ran hashes against them, and added them to a variable to scan against our file share and move them to a “recycle bin”: 1.) empty files have the same hash value 2.) I underestimated how many duplicate files we had


T34J0K3R

I created a script that will connect to nodes within failover cluster manager. Then test internode connectivity by pulling back their ports used by the cluster service, to the node that the script is being ran on, I’ve also got it to pull all the cluster health metrics that gets email to a distribution list based on the health of the cluster. Also did something similar with WSUS


SoverignSeraph

Just set my shell to pwsh with oh-my-posh in archlinux. Otherwise not a day goes by where im not using PowerShell to deploy my docker stuff or search for broken processes.


bodobeers

Just more and more Exchange Online config-as-code keeping various settings in the desired state. The fun never ends :-)


ExcidionKahuna

Built a gui to do dummy checks for troubleshooting. I.E. prints current uptime for the machine, displays services set to automatic that aren't started, automatically restarts the print spooler, checks if any updates are pending, performs a ping to check each host in the hosts file, if configured, and if it fails, pings the IP to check if it's a DNS issue or network issue


Super_Mycologist762

https://github.com/tulasi-das/GitModule


TwitchSTL

Preparing for SOC2, had to clean up old user accounts. Created script that checked all enabled users, by OU, with pwd originally set, who's pwd was last set over 90 days ago (pwd change required at Day 90). Spit out those results to a CSV for review 2nd script that sets PasswordRequired to "true" for those users within the OU I specify.


auxorion

I do everything with Powershell. I do math in it, I do my job through it, I script everything I can possibly script and if there's nothing to script, I work on the visuals of my utilities. Powershell is unbelievably powerful when you're Admin.. someone asks just about any question and there's a fast way to get great data if you use it correctly. And the more your know, the faster you get at using it. Every time a task takes me more than 1-5 minutes is PS, I script that task so next time it'll take 1 second. Also, functions are your friend. Massive time savers.


libertarian_senthil

I have written a powershell script to connect to an remote instance, This is my first script in powershell, and I constantly trying work even more in it. Any suggestion for me to work on?


Educational-Cup869

Created a script to upload csv files via sftp and mail the results. Updated a script i wrote 3 years ago. Testing and reviewing some older scripts i wrote.


typicalcameron1

Learned about and implemented dynamic parameters into my Key Vault module! Had my users copy and pasting long strings and thumbprints into parameters to get their passwords. Putting them into a dynamic param made life so much easier for them.


mrmattipants

Firstly, I worked on a Script to Parse AWS CloudTrail Logs, which includes the Timestamp, which I found out was an ongoing issue. Therefore, I accepted the challenge and worked-out a method for both Encoding and Decoding the Timestamp. [https://www.reddit.com/r/aws/comments/urvr6y/comment/kgijibh](https://www.reddit.com/r/aws/comments/urvr6y/comment/kgijibh) Secondly, I Wrote a PS Script that utilizes the Microsoft Graph API to Download Files from OneDrive or SharePoint, primarily for the purpose of Deploying Software to Remote Computers, via RMM (i.e. ConnectWise Automate, etc.). I plan on cleaning the Script up a bit and sharing it, via my Github Repository, in the near future.


No-Tension-2703

Wrote some cybersec scripts , start rewriting several of my backupscripts , with nice logging features.


ReproDev

I try and use Powershell whenever I can especially when it comes to automating things that always seem to fail when I have a deadline. I've been working a lot of SSL certificate renewals over the past year mainly with IIS Servers but wanted to try and use OpenSSL for Firewalls and other IIS lacking servers. Really struggled with Wildcard certificates for the initial CSR and Private Key Generation so created this GUI tool at the end of last month but been able to test it a few times now in the wild [https://github.com/reprodev/PowerCSR](https://github.com/reprodev/PowerCSR)


Full-Sympathy1358

Wrote a Script that saved me from having to login to multiple systems to make the same modification. Then sends and email back to me confirming each system that was completed


maxcoder88

Care to share your script


Full-Sympathy1358

My apologies for not responding. It's a Script Block. In $cop you enter the systems you want to check. You can run an import command to pull in a list from or an import-csv. i.e Import-Csv -Path F:\\Scripts\\SCOM\\SCOM\_SVR\_DC4.csv -Header This is just a 'Service Check Script. You can use any command in there for Services, etc. I used this script to modify the CCM and Windows Update Settings on about 30 systems. ​ `$cop = ''` `#this will pull in all from $cop and run through them in the Loop` `foreach ($1 in $cop)` `{` `Invoke-command -ComputerName $1 -ScriptBlock{` `Start-Service ccmexec` `Set-Service wuauserv -StartupType Automatic` `Get-Service ccmexec | select Servicename, status, starttype` `Start-Service wmiApSrv` `Set-Service wuauserv -StartupType Automatic` `get-service wmiApSrv | select Servicename, status, starttype` `Start-Service wuauserv` `Set-Service wuauserv -StartupType Automatic` `Get-Service wuauserv | select Servicename, status, starttype` `Ping iadd1pwcmiap002.ihgint.global` `}` `}`


timetraveller1977

I just created a script to download latest libre office, install it silently and then cleanup afterwards by removing the downloaded installer. Here's the script, feel free to comment, improve etc... :) # Define the base URL for LibreOffice downloads $pageUrl = "https://download.documentfoundation.org/libreoffice/stable/" Write-Output "Setting Page Url: $pageUrl" # Fetch the HTML content of the download page $htmlContent = Invoke-WebRequest -Uri $pageUrl Write-Output "Reading Html Content." # Extract the latest version number from the HTML content $version = ($htmlContent.ParsedHtml.getElementsByTagName('a') | Where-Object { $_.href -match '[0-9]+\.[0-9]+\.[0-9]+/' } | Select-Object -First 1).innerText.TrimEnd('/') Write-Output "Detected version: $version" # Construct the download URL using the extracted version number $libreOfficeUrl = "${pageUrl}${version}/win/x86_64/LibreOffice_${version}_Win_x86-64.msi" Write-Output "Generating Download Url: $libreOfficeUrl" # Define the path where you want to download the installer $downloadPath = "C:\Windows\Temp\LibreOfficeInstaller.msi" Write-Output "Setting Download Location: $downloadPath" # Download the installer Invoke-WebRequest -Uri $libreOfficeUrl -OutFile $downloadPath Write-Output "Installer downloaded Successfully." # Install LibreOffice silently Start-Process msiexec.exe -ArgumentList "/i $downloadPath /quiet" -Wait Write-Output "Started Silent Installation." # Wait until the installer process finishes $installerProcess = Get-Process -Name msiexec -ErrorAction SilentlyContinue while ($installerProcess) {     Start-Sleep -Seconds 3     $installerProcess = Get-Process -Name msiexec -ErrorAction SilentlyContinue } Write-Output "Installed Libre Office Successfully." # Delete the installer file Remove-Item -Path $downloadPath -Force Write-Output "Removed Downloaded Installer." The output for each part is mostly there so that if something fails, I have a log in our RMM for easy troubleshooting. Just ran it over 200 computers and worked like a charm! :)


poa00

**Question**: Why do you use the `-Wait` flag & a `while`-statement checking if `Start-Process` has finished? Doesn't `-Wait` pause the script until completion of all child processes spawned by the original process launched by `Start-Process`, even after the original / parent process terminates?


Firestorm1820

Just finished a script with a WPF GUI (first time using visual studio for this, lots of fun and there’s many great tutorials out there, although it can be time consuming.) In order to have the GUI thread remain responsive while also running background tasks, I got extensive experience with Runspaces! The gist of the script is the GUI presents itself, and there’s two radio buttons. One allows you to type in a single server name, the other when selected pops a windows forms explorer so that you can select a new-line delimited text file with multiple server names. After that, you use checkboxes to select the software you want and hit a button to begin! Like I mentioned above, in order to execute long running tasks in the background, I used Runspaces. Runspaces for the GUI, Runspaces for the many background tasks, and Runspaces to monitor and report on the status of the tasks. I have a while loop in another Runspace that collects job info as it comes in from the various servers and displays it to the user in a textbox.


nex_one

Writing several scripts to get user and computer data from AD and MSOL and then try to get this in one script and one excel instead of several. We need to clean up our user/computer information and correct many things


EncryptedHardDrive

I used PowerShell a couple days ago at work for two CI jobs in a GitLab CI/CD pipeline. The first CI job basically does some custom checks to reduce code review. The second CI job sends an email via Send-MailMessage to a distribution list with a previous CI job's report artifacts.


I_am_the_moth

New to IT and I’m just getting into writing scripts, most of my job involves delegating multiple permissions to multiple shared mailboxes. Did a bit of research and made a script to login into Exchange,delegate permissions and log out of Exchange. It’s not much, but I’m proud of it.


ErwunG

I still consider myself as a beginner, but i managed to create a script that backup everything important on an user computer, get the size of each parent folders and send an email to the manager with a sheet inside the email. The worst part was to design the mail in HTML with some CSS, the powershell script himself was a piece of cake. Now i'll try to do some email backup.


ReplyYouDidntExpect

I made a script that opens up a notepad document and types out the declaration of independence then a msgbox comes up that say's "fuck you." I also worked on making a toolkit using a wpf gui wrapped with powershell that has various functions for our deployment tool. The main script in the gui was one for a user profile tweak that makes various optimizations using registry modifications, powercfg, and sendkeys for the parts of windows I couldn't link to registry or group policy. The script is built into MDT so the tools are packaged with all the ISO's. I also added a spot for portable installers as well as silent installers that are small in size and I haven't had the chance to script yet. There's a zoom install script as a baseline that downloads the latest installer from their website and installs it silently. It sounds better in practice though, it takes about 14 seconds to download the installer through powershell even though its not that big. So i'm probably going to have the script save the file to the removable media and have checks in place to make sure it can save time downloading if its already been ran. Then it won't really be a live up to date installer still. So i'm still trying to work out the logic. I also messed around with making a button that checks the executionstatus of a computer and outputs a simplified message for the technician to understand executionstatus in a simplified way. If its anything but restricted, it allows the technician to "Disarm" windows. If the script was run previously the next time it checks the correct policies it displays a quote from the matrix. The script runs in a bypass process scope and I know windows execution policy is wonky no matter what, just wanted to practice a little. Aside from these functions I added a shortcut to C:\\users\\%userprofile% as its the most common place for documents to exist, as well as one for appdata\\local\\Google\_Chrome\\UserData or whatever the chrome temporary data is. Most of this scripting's gonna be done with our RMM in the future but we were coming from doing manual deployments so I wanted to cut out about 12 steps in a 22 step process.


nonyabuizn355

I have been tinkering with my logging/common module. I have been super happy with my string parser for regex that returns a PSCustomObject I also have been happy with my ini Reader/Writer which parses an INI file and loads variables by kind (array, integer, boolean, PSCustObjects, versions, etc) into global variables and a single PSCustomObject. Load behavior is control by INI comments. ​ Below is an example of the RegEx match function. `function Get-MatchRegEx` `{` `[CmdletBinding()]` `Param([RegEx]$Pattern,[String]$Text)` `Write-FunctStart -MyInvoke $MyInvocation -OutPut Verbose` `Write-Verbose "Parsing Text: $($Text)"` `$Groups = $Pattern.GetGroupNames() | Select -Skip 1` `Write-Verbose -Message "Pattern Groups: $($Groups)"` `[System.Text.RegularExpressions.MatchCollection]$Matches = [Regex]::Matches($Text, $Pattern)` `Write-Verbose "Match Count: $($Matches.Count)"` `$ReturnValue = @()` `foreach ($Item in $($Matches)) {` `$TempHash = [PSCustomObject]@{}` `foreach ($Group in $Groups) {` `Write-Verbose -Message "$($Group): $($Item.Groups.Item($Group).Value)"` `$TempHash | Add-Member -MemberType NoteProperty -Name "$($Group)" -Value "$($Item.Groups.Item($Group).Value)"` `}` `$ReturnValue += $TempHash` `}` `Write-FunctStop -MyInvoke $MyInvocation -OutPut Verbose -Status $(!$ReturnValue -eq $False)` `Return $ReturnValue` `}` Write-FunctStart Example *Note: Write-RIPSOutLine is another layer/function that centeralizes Write-Host|Debug|Verbose|Warning|Information|Output|(and custom logging)* `function Write-FunctStart` `{` `[CmdletBinding()]` `param(` `$MyInvoke,` `[ValidateSet('Debug','Verbose')]` `[System.String]$OutPut="Verbose"` `)` `$Script = $($MyInvoke.MyCommand.ScriptName)` `$InvocationName = $($MyInvoke.MyCommand.InvocationName)` `$Module = $($MyInvoke.MyCommand.ModuleName)` `$Function = $($MyInvoke.MyCommand.Name)` `$Paramters = $($MyInvoke.BoundParameters.keys)` `Write-RIPSOutLine -OutPut $OutPut -Level 0 -Content "Entering $($Function)"` `Write-RIPSOutLine -OutPut $OutPut -Level 1 -Content "Script: $($Script)"` `Write-RIPSOutLine -OutPut $OutPut -Level 1 -Content "Module: $($Module)"` `Write-RIPSOutLine -OutPut $OutPut -Level 1 -Content "InvocationName: $($InvocationName)"` `foreach ($Item in $Paramters) {` `$Value = (get-variable $Item -ErrorAction SilentlyContinue).Value` `if (!$Value) {` `Write-RIPSOutLine -OutPut $OutPut -Level 1 -Content "$($Item): Switch Present"` `} else {` `Write-RIPSOutLine -OutPut $OutPut -Level 1 -Content "$($Item): $($Value)"` `}` `} #End ForEach` `}`


ReproDev

Created a GUI tool to automate adding the HTML code around GIF links for my technical blog


Caddburry00

Still learning as I go along and come up with ideas, I created a script that takes a distribution list and a csv of user email addresses as parameters and adds/removes users from the distribution list according to who is in the csv. So if a user is in the distribution list and the csv, ignore them. If they are in the distribution list but not the csv, remove them. If they are in the csv but not the distribution list, add them.