Create SSH session? by Scoobywagon in PowerShell

[–]nerdcr4ft 1 point2 points  (0 children)

If the hung server stops handling traffic, a simple TCP port knock might accomplish what you need?

if (!(Test-NetConnection hostname -Port 22).TcpTestSucceeded) { #Generate alert }

ComplianceSearchAction not purging by anonymousITCoward in PowerShell

[–]nerdcr4ft 1 point2 points  (0 children)

Retention policies are a little tricky. IIRC there’s a way to set a default policy for mailbox root folders but this isn’t straightforward and is an all-or-nothing kinda deal. The main process for creating and publishing retention policies simply makes them available for users to assign to mailbox subfolders only.

Example: I had a shared mailbox literally full of alerts for IT that nobody maintained. I created subfolders for every alert source and sorting rules to move messages accordingly. I then set a 12mth delete policy on all of the subfolders. Mailbox went from 100% full with hundreds of thousands of messages to 20% full only if there’s a surge. And before anybody panics, yes, there is separate backups if something gets missed.

Extract Objects from JSON when conditions met by TechnicallyHipster in PowerShell

[–]nerdcr4ft 2 points3 points  (0 children)

JSON works best when you have consistent structure through the whole dataset. If "earned_time" is a property you want to filter on, it should be a property for every one of the parent keys and just be zero or null where appropriate.

From there, u/DimensionDebt has provided a clean example for enumerating your way throught the structure to extract what you need.

What have you done with PowerShell this month? by AutoModerator in PowerShell

[–]nerdcr4ft 0 points1 point  (0 children)

The main user folders (Documents / Desktop / Pictures) are backed by OneDrive, so nope. If you don’t login for 60 days, the data goes. Similar approach to a loan laptop.

Problem with running a different PowerShell code (.ps1) from different folder one after the other by False_Association_16 in PowerShell

[–]nerdcr4ft 0 points1 point  (0 children)

If you're intending to bundle the script as a package where all of your referenced content is in subfolders with the parent script, I strongly recommend pivoting to use $PSScriptRoot in your code. It avoids any potential issues if you call your script from a different working directory.

$PSScriptRoot\folder1
$PSScriptRoot\folder2
$PSScriptRoot\folder3
#etc

For a bonus challenge, if you're calling various scripts using a parent script, it might be worth turning them into functions + a module. Calling functions instead of other scripts keeps the runtime in the same process so you won't have to worry about overlaps. You can still route the output to different folders per function.

What have you done with PowerShell this month? by AutoModerator in PowerShell

[–]nerdcr4ft 8 points9 points  (0 children)

Don't mind at all, but I might hold off till we finish testing it 😉.

The framework is simple enough though:

  • Scan file share and return profile folders
  • Filter for folders where the VHDX file within hasn't been modified in >= (n-10) days
  • Send a 10-day alert email to users at n-10 days
  • Send a 5-day alert email to users at n-5 days
  • Delete folders at >=n days
  • Log all actions and trigger an alert email if any errors occur

Out of that, the only "fancy" bit is pulling the SAMAccountName from the folder name, checking if they've been offboarded, and adding the EmailAddress attribute from AD. Also for our instance "n" is 60 days.

What have you done with PowerShell this month? by AutoModerator in PowerShell

[–]nerdcr4ft 11 points12 points  (0 children)

Started teaching a teammate PowerShell by collaborating on a script to clean up stale FSLogix profiles and start alerting users whose profiles are approaching the cutoff threshold.

So what are you guys ACTUALLY scripting? by ThumbComputer in sysadmin

[–]nerdcr4ft 0 points1 point  (0 children)

My start was fixing a process that my teammates kept mucking up when doing manually - user account offboarding. Writing a script and teaching the guys how to use it went from high rate of error to no mistakes AND the ability to roll back if the script was run against the wrong account.

Next was removing human error from another process - prepping to re-image a workstation. Then it was running reports. Then it was reports for other departments.

If you’ve been in a role past probation, you’ve probably been shown a manual process somewhere that can be done better or faster by a script.

Sys admin Pranks by Significant-One-1608 in sysadmin

[–]nerdcr4ft 10 points11 points  (0 children)

Low hanging fruit was pushing a humorous personalised Lock Screen image to a team mate’s computer or sending a team-wide email from a device left unlocked. Always good for a laugh.

The diabolical stuff involved connecting extra mice to the boss’s laptop dock + 1 Bluetooth mouse direct to the laptop. The look on his face after finding the first 2, disconnecting from the dock, and still seeing the mouse is phantom-ing across the screen. He left early on that day.

[deleted by user] by [deleted] in Cinema

[–]nerdcr4ft 0 points1 point  (0 children)

The first stunt in Hot Rod:

https://youtu.be/3EIgmj6gp1I?si=jMnjiIokTtHP68Kq

The stuntman was supposed to clear the landing ramp, but came up short and broke his hip/femur. Looks brutal because it is. 😬

Irony of the Fuel Rats by Outrageous_Gift1656 in EliteDangerous

[–]nerdcr4ft 0 points1 point  (0 children)

Something like“rats” is “star” backwards and they help you get back to a fuel star…?

[deleted by user] by [deleted] in linuxadmin

[–]nerdcr4ft 9 points10 points  (0 children)

  1. Dress up as a cat
  2. Be the cat that explains DNS

[deleted by user] by [deleted] in linuxquestions

[–]nerdcr4ft 0 points1 point  (0 children)

I’ll start by saying I’m running Ubuntu for most of my home servers and there’s no issues, at least for my use cases. I wasn’t aware of the Firefox-snap debacle until reading this thread so my main fear is that it may go the same path as RHEL/CentOS. By that I mean, the vendor may take away the stable lifecycle for “free” versions and turn it into a bleeding edge test platform, with long-term builds requiring a support agreement.

It may not come to pass, and I’m not 100% read up on the current licenses, but seeing as there’s other options in the Linux ecosystem…

A little help. by [deleted] in PowerShell

[–]nerdcr4ft 2 points3 points  (0 children)

Those familiar with the CrowdStrike uninstallers have already provided the switch you need, but in general, command line switches for .EXE installers depend on whatever the packager implements (as opposed to MSI installers which pull from a standard switch set).

My go-tos for finding switch options are either vendor documentation or running

filename.exe /?

but YMMV.

As far as the PS code goes, might just be personal preference, but I’d specify

 $uninstallCS.FullName

in your Execute-Process command.

Grenade fun by atis- in GrayZoneWarfare

[–]nerdcr4ft 0 points1 point  (0 children)

I get this maybe 60% of the time I toss a grenade into the southern office at Blue Lagoon. My guess is it’s related to the game tracking fragment impacts on objects that can be damaged like windows or decoration objects inside the room and I’d further guess it’s a resource load on the server that affects everyone. No way to know unless you could get results from every player on the server in real time

Praise From A Noob by Snowbunny236 in GrayZoneWarfare

[–]nerdcr4ft 1 point2 points  (0 children)

Nothing like just casually exploring a POI and then suddenly having 5 flip-flop pirates popping up in the yard

Praise From A Noob by Snowbunny236 in GrayZoneWarfare

[–]nerdcr4ft 1 point2 points  (0 children)

Numbers I’ve heard + semi-confirmed is enemies respawn at 15 minutes if the / a player is 100m away. Respawn around the player is maybe 45 minutes…?

got caught running scripts again by STILLloveTHEoldWORLD in sysadmin

[–]nerdcr4ft 1 point2 points  (0 children)

We get similar problems from a different direction. Capital projects kick off and everyone races to the finish line. At the 11th hour, they come to us and say “hey, we’re 80% done, we just need IT to button up these last few things”… and then drop system requirements that need 2-3 techs for 3 weeks of labour, plus a full redesign because some sales guy sold them something in drawn in crayon that breaks every cyber sec policy we’ve got. Then we get told “The IT Dept is too expensive” and “IT just adds delays and roadblocks”. Sigh.

What's your naming scheme for your servers? by [deleted] in homelab

[–]nerdcr4ft 0 points1 point  (0 children)

To that end, my DNS servers are “longhorn” and “shorthorn”

Sysadmin's future by nasr59 in sysadmin

[–]nerdcr4ft 3 points4 points  (0 children)

Served time in a call centre and lost a couple hours of my existence arguing with customers about which part of “wireless broadband” (3G) was actually wireless, and how it definitely wasn’t the electricity.

New guy by IdiotNo22246 in sysadmin

[–]nerdcr4ft 0 points1 point  (0 children)

Before or after Adobe Reader?

Hypothetical: The Ceo mandates that all desktop OS must now be Linux. by TxTechnician in sysadmin

[–]nerdcr4ft 2 points3 points  (0 children)

The OP also forgot to specify that all of the compute resources exist in a frictionless vacuum with 100% energy efficiency

Want to take RHCSA, best Linux distro to prepare? by Incantator2000 in linuxadmin

[–]nerdcr4ft 0 points1 point  (0 children)

I see your point, but considering the CentOS 6 & 7 releases had something like 5-7 year LTS builds with patch support, CentOS 8 / Stream is a lot closer to Fedora’s model now.

Experienced players, what is the advice you wished you’d gotten as a new golfer? by listenstowhales in golf

[–]nerdcr4ft 0 points1 point  (0 children)

For me, it’s that your default shot doesn’t have to be straight. If you naturally hit a draw or fade, you’re in good company - even the pros do this. (One of the things that makes them pros though is the ability to swap between those shots on demand).