Mike Says Meh The blog of Sys Admin Mike Kauspedas


Bulk add DNS records to domains using GoDaddy DNS

As part of a migration into Azure I need to add the awverify cname record to a LOT of domains. GoDaddy actually made this easy with the bulk command in their portal UI.

  1. Login to GoDaddy and find one of the domains you need to add the records to. Search for the domain and then click on it.
  2. Click on the DNS Zone File tab and add the record(s) you need.
  3. Select the new record(s) by checking the box next to it then click on Bulk Actions at the top and then Copy.
  4. You can either select the domains you want to copy the records to or give GoDaddy a list.
  5. Once you are done give it 10-15 minutes to complete the action.
Filed under: Tech No Comments

Powershell – Find the name servers for a list of domains and spit the results to CSV

Change the path of $list to the path of your text file with the domains. The domains need to be one per line in the text file. Change the $exportPath to where you want to save the CSV file. Then copy and paste the code below into a .ps1 file and run from PowerShell.

$list = "C:\meh\Domains.txt"
$exportPath = "C:\meh\meh.csv"
$apps = get-content $list

$nsresults = @()
foreach ($app in $apps) {
$nsresults += Resolve-DnsName -Type 2 -Name $app | select -first 1 Name, NameHost
$nsresults | Export-Csv -Path $exportPath

Filed under: Coding, Tech No Comments

Fix Certificate warning in Outlook for Mac

A secure connection cannot be established with the server <domain.com> because its intermediate or root certificate cannot be found. Do you want to continue?

If you continue, the information that you view and send will be encrypted, but will not be secure.

Microsoft has a suggestion for fixing this, issue a new certificate with the domain added as a SAN (subject alternative name) or just accept the wrong cert. But I bet you actually have a certificate for the domain name you have Office 365 or Exchange setup on, so why not use it? Here's how.

  1. You need to track down where the domain is pointing to determine where the certificate needs to be installed. You may or may not know this, and I understand because like many of you I am a sys admin that takes over control of already existing systems. Just ping the domain name in the certificate warning (the <domain.com> bit, replace that with the domain in your warning). That will give you an IP, now track that IP to whatever web server, load balancer, or firewall it may be.
  2. Get your certificate ready. I work with Microsoft and IIS nearly exclusively so I have a handy PFX (certificate + private key, don't let this out of your sight). Simply install that certificate to wherever that IP address is terminating. When Outlook resolves the domain name it will try and pull the cert from that device/server.

In my case the server was a reverse proxy load balancer, running ARR, IIS, and network load balancer. With ARR I have SSL offloading enabled so the certificate actually comes from this load balancer, not the web server. I added a binding to the site in IIS with the cert and the warning went away.

Filed under: Tech No Comments

Enable change tracking (CDC) on a MSSQL database when getting Msg 22830

Recently we received a request to enable change tracking on a database but kept getting an error even under a user with the SA role.

Msg 22830, Level 16, State 1, Procedure sp_cdc_enable_db_internal, Line 195
Could not update the metadata that indicates database DBNAME is enabled for Change Data Capture. The failure occurred when executing the command 'SetCDCTracked(Value = 1)'. The error returned was 15517: 'Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.'. Use the action and error to determine the cause of the failure and resubmit the request.

The reason for this error is because you don't have a valid login for the database. This is probably happening, because like me, you restored the DB to another server. So just run the command below to switch the owner and enable CDC. Make sure to change DBNAME to the name of your database.

sp_changedbowner 'sa'

EXEC sys.sp_cdc_enable_db

Filed under: Tech No Comments

It’s Friday – Here is a pic of a SQL server with 1.5TB of RAM

If you're a geek like me then this is pretty f'n cool. Kind of like being able to drive a really fast car. Another cool thing, there are three of these in production.






Filed under: Tech No Comments

FTP access to Azure website with your publishing file

Here is an easy way to gain FTP access to your Azure website.

  1. Download your publishing file from the website dashboard.
  2. Open FileZilla and from the dashboard paste the FTPS address into the address bar. (Always use FTPS when available). The location is on the right hand side. This is an image of mine, yours may be a different address depending on where you website is hosted in Azure.

    azure ftps

  3. Open the publish file with notepad++ (or notepad). The file is going to be named YOUR-SITE-NAME.azurewebsites.net.PublishSettings.
  4. Your user name is the sitename\username. If your site name is contoso and your username is $contosouser in the publish file than your user name would be contoso\$contosouser in FileZilla.

    filezilla azure

  5. that's it, just click connect and accept the certificate.
Filed under: Tech No Comments

Azure website phpmyadmin site extension “No route registered for ‘/phpmyadmin/”

If you aren't already aware there are some helpful tools for Azure websites found at https://YOUR-WEBSITE-NAME-HERE.scm.azurewebsites.net. For example if you website name in Azure websites is mikmeh than your scm URL would be https://mikmeh.scm.azurewebsites.net. You'll need to be logged in, or login to view the site. Lets assume you already know about this and you also discovered the site extensions gallery and you clicked the install button for phpmyadmin. Then after it installed you clicked the play button and you get this.

 No route registered for '/phpmyadmin/ 

There is a super easy fix. Just stop your website in Azure. You don't even need to start it back up, the scm runs under a different worker process. Now you have phpmyadmin the super easy way. It even connects to your existing databases.

Filed under: Tech No Comments

Powershell script to collect a dump of a specific application pool

Procdump needs to be installed on the system. (procdump -i).

Import-Module WebAdministration
$apps = dir IIS:\AppPools\ | Select-Object -expand name
Write-host "Application Pools on this server:" -foregroundcolor red -backgroundcolor yellow
Write-Output $apps
$appname = Read-Host "Enter AppPool Name"
$apid = Get-WmiObject -NameSpace 'root\WebAdministration' -class 'WorkerProcess' -ComputerName 'LocalHost' | Where-Object {$_.AppPoolName -like "$appname"} | Select-Object -expand processId
procdump -ma -r $apid

First we import the webadmin module. Then list out the application pools on the server so you don't need to open IIS or run appcmd list wps. Then it asks you for the name of the app pool which you can now copy and paste from the list provided. Then it finds the process ID and invokes procdump to take a full user dump with reflection (-r) to prevent the application pool from going down.

I did some very minor testing by just running apache bench on a site to create a bunch of requests and then running this script to see if it brings it down. All my requests were successful and my DotNetNuke site didn't warm back up. I'm not 100% confident this is production safe, but at least it's ready for testing.

Filed under: Tech No Comments

Replace command prompt with Windows Powershell in Windows 10

I'm an early adopter, yay! Well, actually I have a 2 in 1 laptop so Windows 10 seemed to make sense and I decided to upgrade today after reading about it. It's basically what Windows 8 should have been, although I like Win8 as well. Anywho, maybe this was availble in Win8 as well, but you can replace cmd with ps1!

1. Right click on your task bar and click properties.

2. Click on navigation and check the box to replace command prompt.

replace cmd with ps1


3. Now when you right click on the start menu button you will see Powershell instead of command prompt.


replace cmd with ps1 2

Filed under: Tech No Comments

How to remove all partitions from a disk

Here is an old one that I have been using for years and never thought to document here on my site. Btw, I use this blog a lot for my own documentation. Reason 1 to blog in IT. Want to get rid of everything on a drive? I mean everything, all partitions, data, EVERYTHING. So keep this in mind. Because if you want to save anything make sure to back it up first. Also, this doesn't completely wipe the drive, it could still be recovered using some utilities. If you want a military grade wipe go shoot it a few times, or use one of those military grade drive wiper cleaners, or toss it in a really hot fire while you're camping. Probably easier to use the software drive wipers.

1. Open command prompt as administrator.

2. Type diskpart and hit enter.

3. Type list disk and hit enter.

4. View the disks in the list and type select disk X with X being the number of the disk you want to wipe. Be very careful, triple check that list because you don't want to wipe the wrong drive. In my example I had 3 disks attached to my system but I only wanted to wipe one.

5. After you select the disk just type clean and hit enter. Here is what you should see.


Microsoft DiskPart version 6.3.9600

Copyright (C) 1999-2013 Microsoft Corporation.

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          167 GB      0 B
  Disk 1    Online          298 GB      0 B        *
  Disk 2    Online          465 GB      0 B

DISKPART> select disk 2

Disk 2 is now the selected disk.


DiskPart succeeded in cleaning the disk.

6. Voila, it's like a brand new hard drive.

Filed under: Tech No Comments