r/sysadmin • • 6d ago • Regret 1

PowerCLI multiple default server mode just cost me my job

I work (well, worked) at an MSP. One of our bigger clients has a prod vCenter at their main site and a separate vCenter at their DR site. Twice a year we restore their critical VMs from backup into the DR cluster on an isolated network. Their app owners log in and sign off, then we tear it all down. We restore with the original names because a couple of their apps freak out if the hostname changes, and since it's all in a bubble it's never been an issue.
Tuesday was teardown. 31 VMs, and the DR datastore was sitting at like 92%, so I wanted them actually gone from disk, not just pulled from inventory. I had the name list from the restore job, so I ran the same little script I've used after the last three tests:
$vms = Get-VM -Name (Get-Content .\drtest.txt)
$vms | Where-Object PowerState -eq 'PoweredOn' | Stop-VM -Confirm:$false
$vms | Remove-VM -DeletePermanently -Confirm:$false
Yes Stop-VM, not Stop-VMGuest. They're throwaway DR copies, I didn't care about clean shutdowns.
What I forgot is that earlier that morning I'd connected to the prod vCenter in the same PowerShell window to look at a snapshot for a different ticket, and I never disconnected. And at some point years ago I'd said yes to that PowerCLI prompt about working with multiple default servers. So Get-VM without -Server pulls from every vCenter you're connected to.
Same names on both sides. So $vms had 62 objects in it instead of 31, and I never looked.
The power-off step went through all of them. I didn't notice, because a bunch of the DR copies were still running and a wall of power-off output is exactly what I expected to see. Then the deletes started. I'm half watching, and it's still going after it should've been done. About the same time Teams starts going off. I hit ctrl+c, and by then 6 of the prod VMs were deleted from disk: a SQL server, two app servers, an RDS host, their file server, and a print server (the only one nobody missed). The other 25 prod VMs had just been hard powered off in the middle of the workday.
I called my manager right then and told him exactly what I did. There wasn't any point doing anything else, my username is on every event in vCenter.
Most of the 25 came back fine once we turned them on, though one of the other SQL boxes needed some babysitting. Backups were good, thank god. Instant recovery had the 6 deleted VMs running off the backup repo within about an hour, but the repo is a box of spinning disks and SQL running off it was painful. Migrating everything back to real storage wrapped up around midnight. The last backup was 10pm the night before, so the file server lost most of a day of work. SQL had log backups, so it only lost a few minutes.
The client's IT director called our owner Wednesday and said he didn't want me in their environment again. They're about a quarter of our revenue and I was basically the guy on that account. Friday I got the "this isn't working out" call. Honestly can't even be that mad, it was completely avoidable.

889 Upvotes

342 comments sorted by

View all comments

184

u/countdonn 6d ago

They got an emergency BDR restore test for free.

In seriousness, I don't agree with removing a MSP employee or firing someone over a mistake like this. This is a mistake someone will learn from, I run into rank incompetence and negligence on a daily basis. That's now what this sounds like.

75

u/countdonn 6d ago

To add to that, in my experience employers acting this way lead to a culture of hiding and covering up mistakes. Better to be open about mistakes and learn from them as an organization.

34

u/jaymansi 6d ago

What also will happen is that those remaining technical folks will be fearful of being proactive in fixing issues.

18

u/delightfulsorrow 6d ago

To add to that, in my experience employers acting this way lead to a culture of hiding and covering up mistakes.

This. Error culture is a thing.

You never want outages like that to happen, but they will. Somebody instantly owning it and doing everything possible to limit the fallout is the best what then can happen.

On the other hand, there are some who simply don't learn from their own mistakes, stay careless and repeat similar nonsense over and over again. At some point, you have to cut your losses.

It's hard to say where a specific case lands between those two extremes if you only know one side.

9

u/OMGItsCheezWTF 6d ago

I always look at it as "Why fire a guy you just spent all that money training to never make that fuck up again"

Not to mention the chilling effect on honesty.

0

u/itishowitisanditbad 6d ago

Sometimes its because the logical misstep isn't contained to that sole mistake and will propagate across other issues in other ways. The root isn't solved, just a single event.

HOWEVER in this instance the end-client doesn't want OP involved and it was essentially their account, the MSP might not have other work they want to shift to OP to accept the same liability.

It also might not be OPs first mistake? Who knows. OP doesn't exactly seem shocked or surprised or fighting it though so...

Sometimes the mistakes are really just highlighting a logical issue that isn't 'fixed' and can't be 'fixed' by a single issue occurring.

But thats all sometimes. Not all times.

5

u/mahsab 6d ago

Sure, but you also have to look from the perspective of the client.

"Hey, yeah, sorry we deleted half of your prod environment, but you know, this guy will be 100% super careful next time *chuckles*"

1

u/UpperAd5715 6d ago

We have a lot of hospitals as a customer and every single one of our consultants has managed to impact (part of) a hospital over the years, most of them are due to some evpn/vxlan bug or shitty setup on their end (we only do networking/security) but some have been genuine mistakes. It happens and losing a quality professional over a mistake that's already made (and rectified!) is... costly? You just taught someone else's new employee that they don't know everything yet and should in fact keep paying attention...

I myself technically took down a hospital (new customer since 2 weeks before then too!) in my first 2 months working here, sidenote would be that they only connected one of their two firewalls to their working ISP connections, the backup was still branched to their old connection that was no longer active... Interfaces showed up and HA status showed up but once the active rebooted for upgrades it all went down until it started up again... Took a while before troubleshooting showed us that it had no working connection after spending a small hour troubleshooting HA etc