How to delete SQL Maintenance Plan text reports

Posted on Updated on

By default, SQL keeps track of all SQL Maintenance plan operations. And it creates reports about them every time they run in the \MSSQL.1\MSSQL\LOG folder. And overtime, these reports take up a lot of space.

Here are some things you can do to manage these files:

1. First, you can try to move the files to a different drive

– Login to SSMS, and open one of your maintenance plans

– Open ‘Reporting and Logging’ by clicking on the icon to the right of Manage Connections

– Set the new path for the LOG files

2. Another option is to add a task in your maintenance plan to clean up the reports

– Add History Cleanup Task in your maintenance plan (optional)

– Add Maintenance Cleanup Task and set type as ‘Maintenance Plan Text Reports’ and specify the LOG folder path.


How to enable deduplication in Windows 8

Posted on Updated on

1. Download the package from the link and extract it in ‘C:\windows\system32’ folder

2. Run this command on elevated rights, this will add the package under ‘Programs and Features’ dism /online /add-package / / / / / / dism /online /enable-feature /featurename:Dedup-Core /all

3. Next step is to enable Deduplication on a volume, by running an elevated Powershell Enable-DedupVolume <Drive Letter>

4. To return a list of volumes that have been enabled for data deduplication Get-dedupvolume | format-list

5. To start a dedup job Start-DedubJob -Volume <Drive Letter> -Type Optimization

6. You can query the progress of the job on the volume by using the ‘Get-DedupJob’ cmdlet

7. To check the status of deduplication, run the cmdlet ‘Update-DedupStatus <volume name>’

Powershell script to remove white-spaces on a CSV file and convert the time entry to 24-hour format

Posted on Updated on

#Here is a script to remove white-spaces on a CSV file and convert the time entry to 24-hour format.

$fileInput = <location and filename of the input file>

$fileOutput = <location and filename of the output file>

$delimeter = ‘,’

$header1 = ‘#Phone,Original Record,Client ID,Sub-Campaign,Device Attempted,Device Locale,Date Time,Last State,Last State Seconds,Call Seconds,Call Result,Best Contact’

# check if input file exist

if (!(test-path $fileinput)) {

write-host “File not found” exit


# check if output file already exist, delete file if true

if (test-path $fileoutput) {

Remove-Item $fileoutput


# import and build CSV in memory

#note single word IDs work better, I.E phone otherwise they need to be named with quotes

$header = “Phone”,”Original Record”,”Client ID”,”Sub-Campaign”,”Device Attempted”,”Device Locale”,”Date Time”,”Last State”,”Last State Seconds”,”Call Seconds”,”Call Result”,”Best Contact”

$csv = import-csv -path $fileInput -header $header

$csvTest = @();

# Display function for military time

# Input String

# Output String

function DisplayMilitaryDateTime( $InputDateString ){

[System.DateTime]$convertedDate = [System.DateTime]::Parse( $InputDateString );

#5/16/2014 13:00:02

return $convertedDate.ToString(“MM/dd/yyyy HH:mm:ss”);


Add-Content -Path $fileOutput -Value $header1

# all the clean and conversion of data would be here

foreach($line in $csv){

$outLine = “”;

# cleanup data and convert it

$outLine += $line.Phone.Trim(” “) + $delimeter ;

$outLine += $line.”Original Record”.Trim(” “)+ $delimeter;

$outLine += $line.”Client ID”.Trim(” “)+ $delimeter;

$outLine += $line.”Sub-Campaign”.Trim(” “)+ $delimeter;

$outLine += $line.”Device Attempted”.Trim(” “)+ $delimeter;

$outLine += $line.”Device Locale”.Trim(” “)+ $delimeter;

#note the function call

$outLine += DisplayMilitaryDateTime( $line.”Date Time”.Trim(” “) ) + $delimeter;

#this is added so another ‘,’ is added

$outLine += $delimeter; $outLine += $line.”Last State”.Trim(” “) + $delimeter;

$outLine += $line.”Last State Seconds”.Trim(” “) + $delimeter;

$outLine += $line.”Call Seconds”.Trim(” “) + $delimeter;

$outLine += $line.”Call Result”.Trim(” “) + $delimeter;

$outLine += $line.”Best Contact”.Trim(” “);


# manually build the output line and append it to the file

Add-Content -Path $fileOutput -Value $outLine }


#finally export it

# $csv | Export-Csv -Path $fileOutput -Delimiter ‘,’ -Encoding UTF8 -NoTypeInformation


#delete input file after successful conversion

Remove-Item $fileinput

How to test a SQL Connection String using notepad

Posted on Updated on

1. Open Notepad and create an empty file and save it with a .UDL extension. Example. Connect.UDL

2. Go to your desktop and double-click on the file you just created and the Data Link Properties box will popup.

3. Select the Provider tab and Find the provider that you want to connect with and click Next.

4. Now from the Connection tab, select or enter your source/ server name -> then enter information to log on to server -> and select the database on the server.

5. Click Test Connection and click OK to save the file.


NOTE:  If you get an error with the connection testing, please make sure that the SQL Server Browser is running.  You can check this by opening SQL Server Configuration Manager on the SQL server and go to the Services menu.