Sometimes, the things I love most about my job...

SketchMaster

Diamond Member
Feb 23, 2005
3,100
149
116
...Are things I can automate.

New boss: "I need you to email me what days you've worked on-call."
Me: "I've always worked every other week. That's never changed since I started working here three years ago."
Boss: "I'd really like to get an email at the end of every on-call shift so I know."
Me: "Ok, I think I can do that..."

Code:
$startdate = (get-date).AddDays(-7).ToString('d')
$endDate = Get-Date -Format 'd'

$body = "Sketchmaster was on-call from $startdate to $enddate"

send-mailmessage -SmtpServer "workemail" -to "boss" -from "Sketchmaster" -subject "Sketchmaster on-call: $enddate" -Body $body

Set as bi-weekly job on a server I own.

Done.

Boss successfully automated.
 
Last edited:

ponyo

Lifer
Feb 14, 2002
19,688
2,811
126
You guys are nerds. I'm jealous. I wish I knew how to do that.
 

Red Squirrel

No Lifer
May 24, 2003
70,425
13,735
126
www.anyf.ca
Haha nice. Always great when you can automate something, or make something that makes your job easier. We have tons of spreadsheets and documents spread all over the place in a huge mess. We basically take care of 3 separate telcos and they each have their own spreadsheets and set of processes etc. Pain in the ass having to sift through those. Been working on a web based system to enter all that info in. Will be so nice once it's done as now we'll actually be able to make changes. With a bunch of spreadsheets all over, it's kinda hard to make changes as it's not centralized and even if it was, it would be read only except for the first person that opened it. My system will solve this by having a proper web interface and central database.

Downside is they force reboot our machines all the time, so the web server VM always goes down. I need to figure out a way to make it come back on it's own.
 

SketchMaster

Diamond Member
Feb 23, 2005
3,100
149
116
You guys are nerds. I'm jealous. I wish I knew how to do that.

https://www.pluralsight.com

Find something simple you hate doing: Moving files, emailing someone, etc. Then start googling how to write a script to do that. Python, bash, and Powershell are all great things to know. I knew a Network security guy that automated his entire job using Perl. Used the time to work on other projects, and kick some ass at ping-pong.

I also know a couple PMs that use Powershell and Excel to automate project reports. You don't have to be in IT to benefit from scripting and automation.
 
Last edited:

gorcorps

aka Brandon
Jul 18, 2004
30,739
454
126
Your boss sounds like a micromanager. Did he say why he needs to know?
 

SketchMaster

Diamond Member
Feb 23, 2005
3,100
149
116
Your boss sounds like a micromanager. Did he say why he needs to know?

Yes and no... My boss left so I'm reporting to their boss directly. They want to know when I worked so they can put in the paperwork to get my on-call bonus paid out. Other teams will swap shifts a lot, but we hardly ever do that. My old boss just had an outlook reminder and, unless we emailed them saying otherwise, assumed I was the on-call that week.

This person really wants an email telling them who was on-call. It really sucks for my team because we all were used to how well our boss ran the things. It was disappointing but not surprising when my boss got poached by another company.
 

Red Squirrel

No Lifer
May 24, 2003
70,425
13,735
126
www.anyf.ca
What are you using to host the VM? Hyper-v, or VM workstation?

Just Virtualbox as I want to use something free, and not pirate. It's a win7 machine on the domain, and this is kinda "covert" (boss approved but not an official IT managed deployment) so have to use what we have, ex: they would not let us install Linux on bare metal. Having worked in IT myself I can understand they don't want rogue unmanaged machines on the network.

I did find a program that will supposedly let you run VB as a service, but I could only find it on Sourceforge. I am not installing something from SF on the corporate network.
 

Imp

Lifer
Feb 8, 2000
18,828
184
106
Reminds me of a terrible job I had. Geniuses decided they needed a centralized, custom database, so they paid someone to make that. But it sucked. So, while that database had to be kept up to date, a separate Access database that wasn't user friendly also had to be updated. Then a user friendlier Excel spreadsheet. Spent half a year doing that, updating all three databases whenever something new came in.
 

SketchMaster

Diamond Member
Feb 23, 2005
3,100
149
116
Just Virtualbox as I want to use something free, and not pirate. It's a win7 machine on the domain, and this is kinda "covert" (boss approved but not an official IT managed deployment) so have to use what we have, ex: they would not let us install Linux on bare metal. Having worked in IT myself I can understand they don't want rogue unmanaged machines on the network.

I did find a program that will supposedly let you run VB as a service, but I could only find it on Sourceforge. I am not installing something from SF on the corporate network.

Honestly, that sounds very easy to setup on its own system. If IT is aware of it then I'd talk to your boss to try and get some buy-in to make it a production asset. It also sounds like something that can be taken care of by an off the shelve app, but I'm not sure what your requirements are. I try to stay away from getting too clever with creating home-brew solutions. When/if you leave the company that system becomes some poor SOB's job to try and maintain.

1439333964-2015-08-03-381.png



It also sounds like an inefficiency that lean six-sigma would be all over. Trying to hand-jam multiple spreadsheets sounds like a royal waste of time. How big is your company?
 
Last edited:

Red Squirrel

No Lifer
May 24, 2003
70,425
13,735
126
www.anyf.ca
It's complicated, since we are a local company, but owned by a large national company, the companies we manage are also owned by said company but all treated separately. So different spreadsheets/formats/systems for each one. (we have like 10 different ticketing systems and at least 30 different passwords, it's quite ridiculous).

This thing could easily run on a Raspberry PI, but the issue is getting a static IP/hostname. With Windows you have the netbios name, which is registered in AD, so that is static. (the VM is set as NAT, so it's like if the service is hosted right on that machine) But a non AD system is not going to have a static way to access it. That and it would show up as a rougue device - if it even GETS an IP. I think it would just get locked out and the port would shut down as it's not registered.

I don't want to use Access, that gets messy too - we already have some stuff in Access too which I want to move to our new system. My solution is a proper web based php/mysql setup that we can easily customize and it will be intuitive and easy to use and not rely on anything on the machine. (less chance of stuff breaking - a lot of our Access stuff broke when they upgraded office)

Basically the idea behind this program is that it will be a "one stop shop" for information. I want to know any info about any of our buildings or techs etc it will all be in there and cross referenced with each other. The system will be custom to our needs, essentially.

If we did something official, the same company that botched the healthcare.gov site would be involved so we would get something that does not work. I laughed so hard when I heard about all the issues with that site on the news and found out it was that company.

Oh I almost forgot, one of the databases that will be moved to mine is a system used to call out techs. For some weird reason any time managers try to make a change in it, everything reverts, there is also no functionality to delete techs (Ex: when they retire... or pass away). We have no way to update it ourselves either. It's also very disorganized and hard to know who to call sometimes. It's happened where I go to call a tech to go on a trouble at like 3am to get their widow wife telling me he's been dead for 5 years. That won't happen with my system. :p
 

SketchMaster

Diamond Member
Feb 23, 2005
3,100
149
116
Oh... Public sector.

Yeah, I know that company. I turned down a job they offered on the HC.GOV project. No pile of money was worth that mess.

My advice:

Do this, but instead of dragging it to the startup area you need to make a windows task.
  1. Open Task Scheduler
  2. Click on Action > Create Task
  3. Name your task
  4. Under security options set the user you want to run the script under and change to "Run whether user is logged in or not"
  5. Click Triggers > New
  6. Click "Begin the task" dropdown > Select "at Startup"
  7. Check the "Delay Task for" and set it for enough time to allow the system to settle in after a reboot or let additional patching finish
  8. Go to actions tab > New
  9. Browse to your script
  10. Ok, Ok, enter password if prompted.
  11. Reboot to test.
 

Red Squirrel

No Lifer
May 24, 2003
70,425
13,735
126
www.anyf.ca
Hmmm I can't recall why a scheduled task did not work, pretty sure I visited that method but I may have to revisit as I really can't see why it would not work. I actually almost have it working as is with it in the startup folder, the problem is that there is a "security banner" before the login screen comes up, someone has to RDP into the machine to hit OK so that the rest of the sequence continues. But if I can have it running truly in background with user not logged in that may very well work fine. There's a reg hack to get rid of that but it gets reapplied after the reg hack actually runs.

Another thing I need to figure out is how to get the VM to shut down properly instead of going down hard, as eventually the DB or VM itself will corrupt from all these bad shut downs. I keep lot of backups mind you but still a pain if it needs to be rebuilt. One thing that's actually crossed my mind is to put another NIC in that machine and set up ICS then actually run the web server on a raspberry PI or other machine. Then that machine is basically just a router and they can shut it down and reboot it all they want it won't affect the DB system other than temporary cut connectivity.

I'll see how it goes once I have the actual DB system running though, as we do have some web stuff on there that is working fine but if we really start to rely on it it needs to be solid.
 

SketchMaster

Diamond Member
Feb 23, 2005
3,100
149
116
Yeah, when you have a fly by night system you are really at the mercy of the patching calendar. You'll have to plug into a lot of back end stuff to click an ok button at startup. Depending on what kind of security/IT audits the systems have it's going to look really sketchy doing that kind of hacking. (Read: gold disk)

You really should get this on its own server. I'd try and find a stakeholder that owns a server, talk to them about how the app can help them, and what the footprint would be. If needed, be ready to buy a good microbrew or bottle of booze to lock in the deal.
 
Last edited:

Red Squirrel

No Lifer
May 24, 2003
70,425
13,735
126
www.anyf.ca
Funny thing is we were originally going to get an official server, there was an official coding project (that would have eventually turned into what I'm working on now) me and a coworker were assigned to start working on and they actually approved it and everything. Then, nothing. I am wishfully hoping that once this system proves itself they may actually want to get a more official server setup and pull on the right strings to make it happen. Even if IT wants to keep root access and we get a regular account, would be better than nothing as long as it runs Linux. I know if *I* was IT I would not really want people running their own servers, and the reason is because when it fails, guess who they go see? In my case, I would not do that, but I've seen it too often working in IT myself. My favourite was medical data on a raid 0 in a closet and a drive failed. "we just need it to work!"

I guess we kinda went off topic here.... but it is off topic forum... lol.
 

SketchMaster

Diamond Member
Feb 23, 2005
3,100
149
116
Honestly, I would try to re-light that fire and get it official again. There are too many applications like yours at my company. Someone created a POC that never got off the ground but people used it anyway and leadership just shrugs when it goes down because it's not their concern. That poor SOB now has a section of the company yelling at them to get the system back up, all while trying to do their "real job". They have to deal with all the shit without any support or recognition.

It's a development project. It needs budgeting, support, training, and documentation. Do yourself a favor and get that thing on the radar so you can focus on building it instead of being a one-man show.