Masthash

#Powershell

Dan Schroeder
36 minutes ago

Did you know you can resolve file and directory paths that don’t exist in #PowerShell. Not with Resolve-Path or Join-Path though; that would be too easy 😛

https://blog.danskingdom.com/Resolve-PowerShell-paths-that-do-not-exist/

Sass, David
8 hours ago

#PowerShell Miniconf the fall edition of #PSConfEU

The Gather platform 👇
🕹️ 2D environment, retro-gaming feel, making meetings more interactive.
👾 Avatars walk in and out of a conversation, where the cameras and microphones are enabled when they get close-by
💬 Talk with #PSConfEU speakers, the @PowerShell_Team
or your peers!

PowerShell Miniconf

The Gather platform 2D environment, retro-gaming feel, making meetings more interactive.  Avatars walk in and out of a conversation, where the cameras and microphones are enabled when they get close-by  Talk with #PSConfEU speakers, the 

@PowerShell_Team

or your peers!
Adam Driscoll
9 hours ago

In #PowerShell Universal v4.2, you'll be able to setup minimal environments for jobs that just use STDOUT and STDERR. This means you'll be able to directly run and schedule things like #python scripts.

My premium #PowerShell subscribers are learning more about managing extended file properties. https://jeffhicks.substack.com/p/more-property-management-options

Mårten Åsberg
2 days ago

I wrote the following #powershell command to find out who had written line containing "MongoDbHealthCheck". I'm pretty happy with it but I suspect it can be written more concise on #linux with awk and xargs and such. Any #scripting gurus out there that are of a challenge?

git grep MongoDbHealthCheck HEAD | sls "HEAD:(.*?):(\d+):" | %{ $null,$p,$l = $_.Matches.Groups.Value; git blame -L "$l,$l" $p HEAD }

Doug Metz
2 days ago

Still time to register for today’s webinar, Responding at Scale with Magnet RESPONSE. I’ll be online for Q&A for the 1pm and 4pm sessions. #DFIR #PowerShell #triage #IncidentResponse https://www.magnetforensics.com/resources/responding-at-scale-with-magnet-response/

Bernhard
2 days ago

:microsoft: :azure:

Wenn der #Selbsthass keine Grenzen kennt, kann man mit #PowerShell und #MicrosoftGraph Benutzer anlegen und zu #MsTeams hinzufügen.

Man braucht zwischen den Vorgängen nur unzählige Start-Sleep und "Hat-das-jetzt-funktioniert?"-Abfragen, weil die tatsächliche Cloud-Befehlsverarbeitung etwas länger dauert und nachfolgende Befehle ins Leere gehen würden. 🤪🔫

#cloud #microsoft #azure #m365 #o365 #sysadmin #automation

Clayton Tyger
2 days ago

Quick Use of #OpenAI to end processes using #PowerShell

It’s definitely getting better, but still always have to double check like all code you didn’t write.

https://clatent.com/2023/09/quick-use-of-openai-end-processes/

Dan Schroeder
2 days ago

The #PowerShell tiPS module v0.5 is out. This version remembers which tips have been shown to prevent some tips from being shown repeatedly while others have not been been shown yet.

https://github.com/deadlydog/PowerShell.tiPS

Vlad :verified:
2 days ago

The latest release of PSBlitz:

- Adds more data to the database-specific "Statistics Info" report page
- Adds more info to the "Instance Info" report page, including a new "Top 10 clients by connections" section.

https://github.com/VladDBA/PSBlitz

#sqlserver #sqldba #powershell #microsoftsqlserver #mssqlserver #mssql #mssqldba #PSBlitz

Heath Stewart
3 days ago

@yosh #PowerShell isn't text-based. Of course, you can pipe text, but objects too. It was this and the scriptability that drew me to "Monad", it's early codename. Rather than modifying scripts for slight variations when needed, I wrote cmdlets with boundless composability. Written in #csharp.

#nushell appears to do much the same. Written in #rustlang.

This is one of the #PowerShell modules I use almost every day. https://github.com/jdhitsolutions/PSClock

Andrew
3 days ago

https://techhub.social/@bmo/111127362388612416

That’s not silly, @bmo, this is silly:

function Single-Dice-Roller([int]$str) {
$maxNum = $str + 1
$rollResult = Get-Random -Minimum 1 -Maximum $maxNum
Write-Output "You rolled $rollResult on d$str"
}
Set-Alias -Name roll -Value Single-Dice-Roller

> roll 20
> You rolled 6 on d20

Inspired by someone’s problem choosing a game to play.

#Dice #PowerShell

BMO
3 days ago

Sometimes @alsorew does silly things for no reason.

Fate/Fudge 🎲Dice Roller in Powershell

function Fate-Dice-Roller {
$rollFateDie1 = -1, 0, 1 | Get-Random
$rollFateDie2 = -1, 0, 1 | Get-Random
$rollFateDie3 = -1, 0, 1 | Get-Random
$rollFateDie4 = -1, 0, 1 | Get-Random
$rollFateDice = $rollFateDie1 + $rollFateDie2 + $rollFateDie3 + $rollFateDie4
Write-Output "You rolled $rollFateDice on 4dF ($rollFateDie1, $rollFateDie2, $rollFateDie3, $rollFateDie4)"
}
Set-Alias -Name rollf -Value Fate-Dice-Roller

> rollf
> You rolled -1 on 4dF (0, 0, 0, -1)

#FateCore #FudgeDice #tRPG #PowerShell

The code is in the post itself.
Adam Driscoll
3 days ago

#PowerShell Universal App Designer training video https://youtu.be/UP6K9xESetk

Clayton Tyger
4 days ago

Hi #powershell friends, I could use your help, I'm trying to permanently delete a #sharepoint team site and it does using #pnppowershell but while completing it says it can't find the group. Has any come across this? https://github.com/DevClate/365AutomatedLab/issues/14#issue-1911181902 Much appreciated!

André
5 days ago

I never thought, I would have a need for that <_<

#pwsh #powershell

The PowerShell under Gentoo Linux running a test script which prints a progress bar with 5 and 4 seconds remaining for task "Dinge".
Doug Metz
5 days ago

Sending this one around again for the weekend #DFIR warriors. The blog has links to the #PowerShell script and an upcoming webinar you can register for, “Responding at Scale with Magnet RESPONSE”. https://infosec.exchange/@dwmetz/111091660638834820

:rss: Hacker News
6 days ago

Blocking Visual Studio Code embedded reverse shell before it's too late
https://ipfyx.fr/post/visual-studio-code-tunnel/
#ycombinator #security #powershell #Active_Directory #Bloodhound

@ekis I use vs code to edit #powershell script, document the with markdown, and illustrate them with a draw.io. works great here.

@deadlydog Some interesting results. In my last #powershell book I showed how to use C# with #pwsh. Fun stuyff

Have you kept up with new submissions to the #PowerShell Gallery? https://github.com/jdhitsolutions/PSGalleryReport

mdgrs
1 week ago

My Outlook folder shortcut opens the email when there is only one unread email, and opens the folder instead if there are many unread emails.

https://github.com/mdgrs-mei/outlook-taskbar-notifier

It doesn't work with the New Outlook for Windows unfortunately😢

#PowerShell

@archer72 So far as I know, there is no way to run a Win10 system (VM or real) without a GUI. But you can certainly use #powershell
ANd did you mean WIndows PowerShell or POwershell (7). They are similar but different

Falk Heiland 🇺🇦
1 week ago

@archer72 #PowerShell is cross platform, just use it on your Linux/Mac

Adam Driscoll
1 week ago
Joel Bennett
1 week ago

@mabster In #PowerShell, when you cast $null to string you get an empty string, which is not the same as $null

[string]$x = $null
$x -ne $null # TRUE

If you want to SET a string to $null so you can null coalesce with it, you have to use NullString, like this:

[string]$x = [NullString]::Value
$x -eq $null # TRUE
$x ?? 'test' # test

For what it's worth, an empty string and $null are both false-ish, so you can use a ternary:

$x ? $x : 'test'

Matt Hamilton
1 week ago

Shouldn't the third command return 'test'? This is #powershell 7.3.6.

#PowerShell Tip: Here's a simple way to see what version of the .NET Framework you are using.

My premium #PowerShell subscribers are learning more about managing extended file properties. https://jeffhicks.substack.com/p/more-property-management-options

Mark Gardner ‍:sdf:
1 week ago

@sreagle @Perl Regarding your Redmond OS: Use #WindowsSubsystemForLinux (#WSL) or #PowerShell for more portable quoting

USB Type-Steve :verified:
1 week ago

"update-module microsoft.graph" should come with a warning: "This is almost guaranteed to break your scripts due to undocumented changes or untested implementations." Sigh...was wondering why a bunch of stuff was failing and it seems they put out a bum update which they've since sent out yet another module update to fix. #PowerShell #MSGraph #SloppyQA

Dan Schroeder
1 week ago

Learn a #PowerShell tip every day by running 3 commands.

https://github.com/deadlydog/PowerShell.tiPS

#Automate your #Learning

3 PowerShell commands to run in your terminal to get a PowerShell tip every day in your terminal.
md
1 week ago

Wrote a small #ChatGPT & Git wrapper in #PowerShell to generate commit messages based on git status and git diff outputs. Works well, writing those has always felt like a chore.

Prefer this to using a VSCode extension as I can stick it in my $Profile and it's available everywhere.

James Bartlett :terminal:
1 week ago

@mcc
#PowerShell is much easier to understand if you break the code into smaller chunks and run it directly in PowerShell *as a shell* (rather than running `powershell.exe -Command …`, which requires lots of escape characters, so it gets very messy).

Example:

```PowerShell
# Declare drive letter to be ejected
$driveLetter = "E:\"
# Initialize a new shell application com object
$driveEject = New-Object -ComObject Shell.Application
# Use the shell application com object to eject the drive
$driveEject.Namespace(17).ParseName("$driveLetter").InvokeVerb("Eject")
```

I hope this helps, but if not, please feel free to let me know, and I'd be happy to help troubleshoot. ☺️

Dennis Faucher :donor: :mastodon:
1 week ago

Spent the week learning to create Docs as Code. Finally wrote it all down including #MkDocs #PowerShell #VMware #vCenter. Enjoy
http://blog.faucher.net/2023/09/automagical-vcenter-documentation-with.html
#vExpert

Dan Schroeder
3 weeks ago

If you write #PowerShell you should check out Jakub Jareš' #Profiler module. In under a minute you can easily see which parts of your code are the slowest, and how slow they actually are so you know if they are worth optimizing.

https://blog.danskingdom.com/Easily-profile-your-PowerShell-code-with-the-Profiler-module/

W.Gross
3 weeks ago

@JamesDBartlett3 Luv it! I think piping is the ididomatic way to code in #powershell. Also I've heard it comes with a performance penalty.
But honestly: I've never done something in powershell that was actually performance critical

James Bartlett :terminal:
3 weeks ago

One of my #PowerShell hacks for #PowerBI just got a huge #upgrade: #Pipeline support!

In layman's terms, this means that one #function can be strung together with another function in a single PowerShell command, and the outputs from the first function feed directly into the second's inputs. The best part is that the whole chain of functions can operate as a #stream, so as soon as the first item is available, it gets passed down to the next function in the chain, which begins processing that item, while the previous function is working on the next item in the queue. It's like an #AssemblyLine for data!

Of course, now I'll have to go back and apply this technique to all of the other functions I've written previously. #NoRestForTheWicked 😈

@adam Sweetn - it would be really wonderful to see the #PowerShell 7 commands to set this up for, say, Contoso.Com

travis
1 month ago

like this:
```
$webClient = New-Object Net.WebClient
foreach ($file in $downloads.Keys) {
$url = $downloads[$file]
$webClient.DownloadFile($url, $file)
}
```
#powershell

Jason Fossen SANS
1 month ago

As always, my SANS Institute teaching scripts for my PowerShell course (SEC505) are free and in the public domain at:

https://BlueTeamPowerShell.com

I teach SEC505 again starting Sept 25, streaming live online. Hope to see you then for six days of PowerShell DevSecOps fun!

#PowerShell #InfoSec #SANS @sans_isc #Security #DevOps #DevSecOps #BlueTeam

Gilbert Sanchez :omya_windows:
1 month ago

Second post is about how I use #wezTerm and some tricks to integrate with #powershell. The next post will probably cover how I use #starship.
https://gilbertsanchez.com/posts/my-terminal-wezterm/

James Bartlett :terminal:
1 month ago

Update: Yesterday's #PowerShell Hacks for #PowerBI session was recorded, and is now available on #YouTube!
https://www.youtube.com/watch?v=DM69QDD3y7Q

James Bartlett :terminal:
1 month ago

Hey #PowerBI and #PowerShell peeps! My "#PowerShellHacks for Power BI" #Livestream with the #TriPASS #UserGroup (#Durham, #NorthCarolina) is starting in 45 minutes (6PM Eastern).

Please join us, bring your toughest PowerShell for Power BI questions, and get ready to learn some amazing tricks for automating and administering Power BI at scale with PowerShell!

#Meetup link: https://www.meetup.com/tripass/events/295221539/

#Twitch link: https://www.twitch.tv/trianglessug

Devin Prater :blind:
2 months ago

Oh wow, so Powershell has these cmdlets (commandlets) that convert output to different formats, like a list or HTML, or even a GUI grid rather than a text table that's hard to listen to with a screen reader. You can even do a CSV and import to Excel or something.

Format as list:

Get-Process -Name lsass | Format-List

GUI Grid:

Get-Process -Name lsass | Out-GridView

#PowerShell #PS #Windows #Microsoft #accessibility

KielKontrovers
2 months ago

@SwiftOnSecurity well.... its not that Windows does not have a #Powershell

Simon
2 months ago

Pour le boulot, je travail sur une petite application web écrite en #golang pour gérer des utilisateurs et des projets dans un AD Microsoft.
Je dois me taper du #PowerShell pour certaines actions...quel calvaire...
C'est une vraie punition de bosser sur des environnements Microsoft 😢

James Bartlett :terminal:
2 months ago

I've been working on #PowerBits (a collection of #PowerShell scripts for #PowerBI 📊 #Admins) recently, and I just made a minor breakthrough. 💪😎👍

One of the biggest missing features of the Power BI #RESTAPIs right now is the ability to export a #Dataset as a #PBIX file. Of course, you can export a #Report as a PBIX file, and if that Report is bound to a Dataset, then the Dataset will be included with the Report when you export it. However, if the Dataset you need to export doesn't have a Report bound to it (I've started calling this a #BareDataset), then the #RESTAPI can't help you. That Dataset can only be exported manually from the Power BI Service using a web browser. Yuck! 🤮

To solve this problem:
1. Find and select a target #BareDataset
2. Upload a #BlankReport to the same #Workspace
3. Re-bind the blank Report to the bare Dataset
4. Export the blank Report as a PBIX file
5. Delete the blank Report from the Workspace

Step 1 Complete (mostly) 😅:
https://github.com/JamesDBartlett3/PowerBits/blob/main/PowerShell/Get-PowerBIBareDatasetsFromWorkspaces.ps1

Screenshot of PowerShell code from:
https://github.com/JamesDBartlett3/PowerBits/blob/main/PowerShell/Get-PowerBIBareDatasetsFromWorkspaces.ps1

Today I made the lights behind my monitor turn brighter automatically, when an app on my PC is accessing the webcam.

Windows shows you in the settings app which app is currently accessing your webcam, and it turns out you can read those values from the registry.

Using Sysmon I can watch for changes in the registry that indicate that an app's started / stopped accessing my webcam and fire Events into the Windows eventlog, and then I attached a Task to those events that forwards the new registry key to #HomeAssistant through a webhook.

Depending on the value sent, HomeAssistant can then turn my lights bright to act as a key light, or reactivate the adaptive lighting that continuously adjusts the light's color based on the time of day :3

#Windows #Sysmon #Powershell

Edit: part 1.5 is here, the threading broke: https://corteximplant.com/@Sirs0ri/110794659498930158

The section of the Windows 10 settings showing wich apps have access to my webcam.

The "camera" app is currently using the webcam.
Kyle Ruddy
3 months ago

(re) #Introduction due to a server migration...

Hi, i'm Kyle. Long-time systems engineer (IT) turned technical marketer with a passion for automation, problems of scale, and sharing knowledge. I'm a blogger, presenter, mentor, mentee, and I recently found myself on the management side of things. Professionally, I've been recognized through advocacy programs like #Microsoft MVP, #VMware vExpert, #Cisco Champion, (Dell) EMC Elect, etc.

Former road warrior, while having greatly enjoyed traveling the world, I'm finding satisfaction in watching those loyalty statuses drop each year. My camera roll was more receipts than anything else for quite a while. Current #FloridaMan, I swear it wasn't like this when we moved here, but I enjoy a relaxing beach and grew allergic to snow and cold weather.

My feed is likely to include #tech, #startup, #cloud, #devops, #terraform, #powershell, with the occasional #beer, #nfl, #mlb, #f1, #dog, #cat, #travel, #Purdue, mention.

I have quite a lot more followers than I did when I first wrote my introduction, so it’s only fair that I’m writing a new one, bump up the major version.

#introduction #intro #introductions

Hi! o/

I am Ștefan (ș as sh, I also accept Stephan or the equivalent in your language). I’m 21 years old, ♑, he/him, proud #leftist and soon to graduate CS @ UVABc. Sort of proudly living in #romania. My native language is Romanian, fairly proficient at English, slowly learning #finnish (and #italian).

Tried a lot of programming languages in my childhood up until now, a non-chronological list of ones that stuck with me for one reason or another being: VB6 (that’s what I started on at 8 years old), #pascal (+ #freepascal and #delphi), #perl (+ #raku), #tcl #tcltk, #lisp (usually #scheme, on a good day #elisp #emacslisp and #commonlisp), #elixir, #php, #forth, #lua, #oberon, #modula-2, #cpp #c++, #ocaml, #fsharp, #smalltalk (+ #squeak #pharo #self), #ada, #powershell, #dart, #matlab, #rlang, #zig, #nim, #cobol and #julia. I don’t claim full proficiency in all of these, but I’m familiar enough with these (+ some others not mentioned here) that I could get along just fine with 2 weeks at most of studying and looking through cookbooks and examples). I’m flexible in learning new languages and technologies if needed.

I also do #sudoku and #math for fun (especially functional equations and number theory problems, sometimes calculus and geometric algebra). I am interested in #linguists, #conlangs (#lojban and #esperanto) and #nlp, contemporary (post-‘45, usually post-‘89 for me) history, #balkan history, lower-level stuff (I like to learn about how tools around me work, I’m most interested in #compilers, #emulators and #microcontrollers), #typography and #latex, #linux + #bsd, #msdos, #amiga, #oberon, #plan9, #philosophy, #astronomy (especially in a worldbuilding context) and #philosophy, along with other less notable interests.

I engage in #politics relatively often irl, although I’m not inserting it in absolutely every scenario in my life. As I mentioned, I’m a #leftist and #progressive (or… um… #woke) (Nazis and fascists can have a merry fuck off, DNI with me). I am also a spiritual person, a #deist (if you really want to put it that way, an agnostic, although it’s not quite true) and I find #astrology and #tarot interesting (I’ll let you guess my moon and ascendant, let’s see how close you are).

With that being said, I hope I’m welcome here, you can pick your subset of things that interest you from this list, you have plenty of options. :P Quite a bit longer than last time, but oh well…

GeneBean
3 months ago

@davidshq so long as you don’t need crazy platforms, a Go binary would be a “write it once” option. Beyond that, I think #PowerShell is good for windows and Bash on everything else unless you are okay telling people to install PowerShell (it works well on Linux and macOS)

Dave Mackey
3 months ago

#question of the day: I want to automate a few steps in setting up a git repo for specific projects. On #Linux I could use a #Bash script...what about on #Windows? #Powershell? I know I could use #WSL or other tools like Cygwin but I'd like this to be something folks don't need to know about Linux to utilize.

Ideally, it would be cross-platform.

Mike Kanakos
3 months ago

@feditips
Are you a #powershell fan and new to #Mastodon ? This thread and others like it is all you need to read to get yourself acclimated.

mdgrs
3 months ago

My #PowerShell terminal today.

I have two cats in the terminal that pass by sometimes. If there is an error, they stop walking! 🐈🐈‍⬛

https://gist.github.com/mdgrs-mei/11121aceb7e147dbe6ab4ab8d2abcd35

#WindowsTerminal

Two cats are passing by on the Windows Terminal tab.

#ICYMI Be sure to check out this week's livestream with #MVP @dfinke 🎉 We had a blast running through #polyglot notebooks #ChatGPT and #PowerShell in VS Code ▶️ https://youtube.com/live/U9S4BMqJPQ8 https://t.co/RPQuVyo9zZ

:sys_twitter: https://twitter.com/code/status/1672354848862351360

Media source: https://pbs.twimg.com/media/FzVl3zaWIAEEgS7?format=jpg&name=orig

⏳ We're live in 10 minutes with @burkeholland and @dfinke. We'll demo #ChatGPT in three different environments! Join us ▶️ https://youtube.com/live/U9S4BMqJPQ8
#copilot #PowerShell #Polyglot https://t.co/EY7P6EsjDo

:sys_twitter: https://twitter.com/code/status/1671893322649190400

Media source: https://pbs.twimg.com/media/FzPCHBnaUAUZ9cz?format=jpg&name=orig
rodtrent :verified:
3 months ago

AzLogDcrIngestPS - This module can ease the steps, if you want to send any data to Azure LogAnalytics custom logs (v2) - using the new features of Azure Log Ingestion Pipeline, Azure Data Colection Rules & Log Ingestion API. Think of this module as an "AnyConnector", which can be used to send data from any 3rd party source using PS script (intermediate) or use as part of a script collecting data from endpoint. It can be used in Powershell scripts, Azure Function, Azure Automation, etc.

https://rodtrent.com/0ed

#PowerShell #Azure #AzureMonitor #DCR

📢 We're excited to welcome MVP Doug Finke to the livestream to demo #ChatGPT in #copilot #polyglotnotebooks and #PowerShell #AI Integration! Mark your calendar 📆 and join us on Thursday🎬 https://aka.ms/code-livestream-page
8 am Seattle / 11 am New York / 4 pm London
@dfinke https://t.co/kE74HFyVP8

:sys_twitter: https://twitter.com/code/status/1670499380971859968

Media source: https://pbs.twimg.com/media/Fy7OVC7WwAUEy7R?format=jpg&name=orig

@JenMsft I even wrote a #PowerShell module to help me manage it. https://github.com/jdhitsolutions/WTToolbox

James Bartlett :terminal:
4 months ago

@StepanResl Thank you so much for having me as a guest on the #PowerBIKaficko #podcast again, this time talking about #PowerShell and #PowerBI! I had a lot of fun, and I truly hope your listeners did as well! 😊

Štěpán Rešl
4 months ago

This is the most extended episode of the #PowerBIKaficko podcast with Jiří Neoral. This episode was with @JamesDBartlett3, and James talked about #PowerBI and #PowerShell. Thank you so much for the knowledge that you have shared with us, James.

Link: https://open.spotify.com/episode/706wt2JXs0A1wMIp8rLbIN?si=8451ee57f2284163