How to Change your Network Profile in Server 2012R2

Network Profiles were first introduced to allow administrators to configure different firewall profiles based upon what network a user connects to.
Administrators could change the profile by navigating to Network and Sharing Center in control panel and selecting the profile which suits their needs.
In Server 2012, Administrators can no longer change the network profile in Network and Sharing Center, they can view just not change.
You can accomplish this in Power-Shell:
To see the current profile:


To change the profile:

Set-NetConnectionProfile -InterfaceIndex 12 -NetworkCategory Private

You can do it with a one line command:

Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private

Get SMO version on your server

A quick way to find out what SMO versions are installed:

dir C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo

Silently Download and Install SQL Server Management Studio (SSMS)

SSMS is now free and no longer requiring licensing.
It is a separate install and has a more frequent release cycle, usually around 30 days.
To be able to maintain up to date a larger number of SSMS installations I wrote a PowerShell Script for the task.
Of course that a better approach will be to make the download once and then propagate it to other servers, but for now, this works best for me.

    Silently Download and Install SQL Server Management Studio (SSMS).
    This script will download and install the latest available SSMS from Microsoft.
    You want to log to a file. It will generate more than a few files :)
    .\Get-LastSSMS -WriteLog 1
    Author: Viorel Ciucu
    Date: January, 2017
#Requires -RunAsAdministrator
param (
    [parameter(Mandatory = $false)]
    [int]$WriteLog = 0
if(-not $PSScriptRoot) {
    $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
$msg = ""
$args = @()
$args += "/install /quiet /norestart" 
if($WriteLog -eq 1) { 
    $args += "/log SSMS_$(Get-Date -Format `"yyyyMMdd_HHmm`").txt"
    $msg = "InstallationLog: $PSScriptRoot\SSMS_$(Get-Date -Format `"yyyyMMdd_HHmm`").txt"
Write-Host "Download starting! Please wait.."
# Start the download
$Domain = ""
$url = ((Invoke-WebRequest -uri $Domain).Links | Where innerHTML -match "Download SQL Server Management Studio").href | Select -First 1
$job = Start-BitsTransfer -Source $url -DisplayName SSMS -Destination "SSMS-Setup-ENU.exe" -Asynchronous
while (($Job.JobState -eq "Transferring") -or ($Job.JobState -eq "Connecting")) { 
    Start-Sleep 5;
} # Poll for status, sleep for 5 seconds, or perform an action.
Switch($Job.JobState) {
    "Transferred" { Complete-BitsTransfer -BitsJob $Job; Write-Output "Download completed!" }
    "Error" { $Job | Format-List } # List the errors.
    default { Write-Output "You need to re-run the script, there is a problem with the proxy or Microsoft has changed the download link!"; Exit } # Perform corrective action.
# We close running SSMS processes
if (Get-Process 'Ssms') {
    Stop-Process -Name Ssms
Write-Output "Performing silent install..."
# Install silently
Start-Process -FilePath SSMS-Setup-ENU.exe -ArgumentList $args -Wait -Verb RunAs
Write-Output $msg
Write-Output "All done!"

Hope you’ll find it useful.

Add syntax color to crontab editor

You might be wondering why you don’t have syntax coloring when you are editing crontab entries.
This can be solved very simply by specifying your editor before starting crontab:

export EDITOR=vim

The change can be made persistent across the whole system if you add that line on the /etc/bashrc file.
You you only need this change for certain users only, add the line to their local ~/.bashrc files.

DTExec: The package execution returned DTSER_FAILURE (1)

What to do when a SQL backup job created with SQL server Maintenance Plans fails with this error?

DTExec: The package execution returned DTSER_FAILURE (1).

Investigate! No useful information in the logs.
Previously that day I dropped a few unneeded databases so maybe the Maintenance Plan was still referencing them. Everything looked good when the Maintenance Plan was opened in SSMS (it was configured to backup “SELECTED” databases), I could not find any reference to the deleted databases. Under the hood, the Maintenance Plan was still trying to backup those deleted databases because when I clicked OK and then hit Save, that Maintenance Plan was refreshed and everything worked just fine.

So always try to find the root cause.

T-SQL to generate backup and restore commands

Hi guys,

Since my day to day job is a DBA, I figured I will share stuff that others might find useful.
For the first time I will share a small script which will help you generate T-SQL commands in order […] Continue Reading…


DriveDroid is an Android application that allows you to boot your PC from ISO/IMG files stored on your phone.
Install it on your android phone and use it to boot any computer.
You can store any number of ISO/IMG files on […] Continue Reading…

Disable recent documents in Gtk2/Gtk3

Use the following to disable recent documents in Gtk2/Gtk3:

echo ‘gtk-recent-files-max-age=0’ | tee -a $HOME/.gtkrc-2.0
echo ‘gtk-recent-files-max-age=0’ | tee -a $HOME/.config/gtk-3.0/settings.ini

The ugly part is that there is no way one can disable ‘Recently Used’ in the GtkFileChooser dialog box.

Quick way to convert Mbox mailboxes to Maildir format

A quick way to convert Mbox mailboxes to Mbox format […] Continue Reading…

Bash script to backup my configs (dotfiles)

I needed some script to take care of my config files and put them in a single directory. So here it is.


# Display All Hidden Dot Files In a Directory
# ls -a | egrep “^\.” >

DESTINATION=”/storage/dotfiles” # […] Continue Reading…