Quantcast
Channel: Questions in topic: "ssis"
Viewing all articles
Browse latest Browse all 813

Powershell script for tab delimited for SSIS upload

$
0
0
Hi Everyone! I have become challenged with a TXT file that a server admin would like for me to upload which he is using a powershell script to output to the TXT file. The format is using a custom format and not using tab delimited so this has been quite difficult for me to work with. In reviewing the Powershell script I found he is using the following:

    # Create a custom object to hold the results
 $results = "" | Select-Object `
 Name, `
 NumOfDays, `
 NumOfCrashes, `
 NumOfReboots, `
 MinutesDown, `
 MinutesUp, `
 PercentDowntime, `
 PercentUptime
 $results.Name = $ComputerName
 $results.NumOfDays = $NumberOfDays
 $results.NumOfCrashes = $crashCounter
 $results.NumOfReboots = $rebootCounter
 $results.MinutesDown = "{0:n2}" -f $downtime.TotalMinutes
 $results.MinutesUp = "{0:n2}" -f $uptime.TotalMinutes
 $results.PercentDowntime = "{0:p4}" -f (1 - $uptime.TotalMinutes/$minutesInPeriod)
 $results.PercentUptime = "{0:p4}" -f ($uptime.TotalMinutes/$minutesInPeriod)
 Write-Output $results
 # Kill our session to the remote computer
 Remove-PSSession -Session $mySession
I believe this is causing the columns to look like the below: (without the spaces between each record - couldnt get this to format right for me in this)

Name            : ServerName
NumOfDays       : 8
NumOfCrashes    : 0
NumOfReboots    : 2
MinutesDown     : 1.68
MinutesUp       : 11,518.32
PercentDowntime : 0.0146 %
PercentUptime   : 99.9854 %
Is there a way I can modify to be tab delimited on output? If I'm in the wrong place do you know of a good Powershell forum I could reach out to? Or do you know of a work around I could do with the current format so that I can build a package around it for data automation upload?

Viewing all articles
Browse latest Browse all 813

Trending Articles