Category: Work

Day job related.

SQL Powershell tools

I’m not sure why MS makes it so convoluted to install these tools on a server that isn’t running SQL.  Regardless, head here:

https://www.microsoft.com/en-us/download/details.aspx?id=29065

And don’t click download.  All that gets you is a text file.  Instead, head down the page and expand Install Instructions.  From there, search for and download the following modules:

  • Microsoft® System CLR Types for Microsoft® SQL Server® 2012 (SQLSysClrTypes.msi)
  • Microsoft® SQL Server® 2012 Shared Management Objects (SharedManagementObjects.msi)
  • Microsoft® Windows PowerShell Extensions for Microsoft® SQL Server® 2012 (PowerShellTools.msi)

If you get a 2503 or 2502 error while trying to install, as I did, you may not have sufficient rights.  Try either killing explorer.exe and restarting it with admin privs or invoking the msi from within an elevated command prompt.

Then just install modules a la:

Import-Module sqlps -DisableNameChecking

Windows: Updating existing ODBC Data Source Drivers

For some reason there still isn’t any easy way to update the driver used on a previously defined ODBC data source in Windows. There’s no option when stepping through the configuration. I suppose you’re expected to delete and recreate the data sources, specifying the new driver at that time. But what if you have dozens, or hundreds, of existing sources?

Do it though the registry.
Continue reading

Windows 10 Hyper V Woes

I recently needed to set up a Win10 Hyper V, and then join it to a domain over a VPN connection.  The first issue that I faced was that Cisco Anyconnect VPN client detected the virtual machine as a Remote Desktop Connection and refused to allow it to connect.  I solved this by switching from Enhanced Session to Basic Session by clicking this on the toolbar of the virtual machine:

My second issue was that, even after successfully joining the machine to the domain, there was no Switch User option (I needed to switch to a domain user while on the VPN in order for it to authenticate to the domain server and build the local profile for the domain user).  No matter where I looked there was no option.  Not in the power options, not via Alt+F4, nowhere.

I solved this by invoking tsdiscon.exe directly via a run line.  Bear in mind that it’s my understanding tsdiscon.exe is not available in Win 10 Home edition, though I don’t know why anyone would build a virt of Home edition.

Windows – Migrating Printers

At my POE we use virtual printers for all manner of file production.  It’s annoying.  What’s more annoying is when it’s time to upgrade a server using virtual printers.  Thankfully there’s a way to sorta kinda help the process, by sorta kinda easing the migration process.  The following screenshots are from Windows 2012 R2.  If you’re using a different Windows OS level your mileage may vary.  It’s my understanding that the titles of some of this differs by OS.

Continue reading

Windows Sticky Notes

I admit it – I use Windows Sticky Notes.  I hate how unconfigurable it feels though.  The font is terrible, for instance.  Lucky you can change it with a reghack.

What’s happening here is, because the notes demand to use Segoe Print as the font, you’re changing what font Segoe Print actually is.  Replace the .ttfs with fonts of your choice.

There are also a myriad of shortcuts for modifying existing note text:

Ctrl+B – Bold text
Ctrl+I – Italic text
Ctrl+T – Strikethrough
Ctrl+U – Underlined text
Ctrl+Shift+L – Bulleted (press once) or Numbered (press twice) list
Ctrl+Shift+> – Increased text size
Ctrl+Shift+< – Decreased text size
Ctrl+A – Select all
Ctrl+Shift+A – Toggles all caps
Ctrl+L – Left aligns text
Ctrl+R – Right aligns text
Ctrl+E – Centers text
Ctrl+Shift+L – Small Alpha list (3rd), Capital Alpha list (4th), small roman (5th), Capital roman (6th)
Ctrl+1 – Single-space lines
Ctrl+2 – Double-space lines
Ctrl+5 – Set 1.5-line spacing
Ctrl+= – Subscript
Ctrl+Shift++ – Superscript

App Pools Gone Mad!

IIS.  I’m not a fan.  But it’s a requirement where I work, so there you go.  Occasionally one of our IIS servers will slow to a crawl or stop responding altogether.  Often it’s a application pool run amok.  An app pool is essentially a container that holds the processes of a web application.  And if your web application isn’t written well, and doesn’t have decent controls in it, it can go nuts.  If someone can, say run an open ended database query with the potential to return a bajillion records because your app doesn’t disallow this sort of irresponsible behavior, the app pool containing that process is going to fill. And fill. And fill, eventually gobbling all  your processor cycles. An easy way to discern this is if the process w3wp.exe is pegging your CPU at 99%.  Find this in Task Manager.

Continue reading

Active Directory Account Lockout – Creation – Deletion – Disable monitoring

We’ve used a variety of third party tools to monitor Active Directory domain account changes.  They’ve all either been expensive or kind of sucked (or, unfortunately, both).  But if you’re running a relatively new OS on your controller you can use the magick of Powershell to ship you alerts on account changes!  Powershell can monitor the local Security Event Log on your controller and ship you an email when events matching your description are entered.  Here’s an example Powershell script:

Continue reading

Cisco VPN Command Line

I work remote, and use the Cisco VPN client to connect to the network.  There’s a timeout set on our concentrator that gives me the boot every day.  It’s a minor annoyance to be sure, but still.  It’s no fun being deep in thought on a server only to be unceremoniously kicked from the network.

So I’ve been fiddling with the command line interface of the client, to see if I can cobble together a script I can schedule to log me out and back in on my time frame rather than that of the concentrator.  Here’s what I’ve come up with so far.

1
2
3
"%programfiles(x86)%\Cisco Systems\VPN Client\vpnclient.exe" disconnect

@echo y | "%programfiles(x86)%\Cisco Systems\VPN Client\vpnclient.exe" connect %1 user %2 pwd %3 nocertpwd stdin

The first line disconnects the current connection (if already disconnected the script continues gracefully).  The second line needs 3 arguments fed to it in this order: profile, username and password.  the @echo y | exists because the concentrator I connect to has a disclaimer splash that requires a Y response to bypass in order to fully establish the connection.

Thus far my only problem is I’ve not found a way to suppress the client GUI window that appears when the disconnect occurs.

Windows 2008 r2 Updates Reboot Loop

Tonight was our maintenance window at work, and I updated a bajillion virtual servers. Went OK save for one Windows 2008 r2 box that got stuck in a reboot loop. Updates failed, so I bounced the box to start fresh.  It would begin boot, show the dialogs for installing/configuring updates, reach “Configuring Updates: Stage 3 of 3,” and crater. Repeat infinitely. Thankfully the fix was easy. I mounted and booted from the 2008 Server ISO and:

  • Selected to Repair
  • Selected the Command Prompt option
  • Executed the command del C:\Windows\winsxs\pending.xml (actually because it was a virt the drive wasn’t C, but you get the idea)
  • Restarted and let it boot from the hard drive

After that it came up fine.