Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Unable to automate the Script Expand / Collapse
Posted Thursday, May 16, 2013 3:04 PM



Group: General Forum Members
Last Login: Today @ 11:09 AM
Points: 2,267, Visits: 3,110
The below script provides the list of trace files available to the location : D:\Trace

$fileEntries = [IO.Directory]::GetFiles("D:\Trace\");
foreach($fileName in $fileEntries)

I want to pass each trace files to the below block to change the trace files compatible to SQL 2008 R2 format.

# Enter your filename here
$fileName = "D:\Trace\XXXX.trc"

# The version information we want to write: 0x0A = 10 = SQLServer 2008
[Byte[]] $versionData = 0x0A
# The offset of the version information in the file
$offset = 390

[System.IO.FileMode] $open = [System.IO.FileMode]::OpenOrCreate
$stream = New-Object System.IO.FileStream -ArgumentList $fileName, $open
$stream.Seek($offset, [System.IO.SeekOrigin]::Begin);
$stream.Write($versionData, 0, $versionData.Length);

Kindly assist....

Post #1453793
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse