Collect performance data from remote servers

To collect performance data from remote servers, when running a load test for example, use the following PowerShell script: clear$testId = "doodle"$durationSeconds = 20$threadsPerAgent = 5$client = ""$counterList = @( ".NET CLR Exceptions()# of Exceps Thrown / sec", ".NET CLR Memory()# Total committed Bytes", "\ASP.NET\Application Restarts", "\ASP.NET\Request Wait Time", "\ASP.NET\Requests Queued", "\ASP.NET Applications()\Requests/Sec", "\Web Service()\Current... Continue Reading →

Powershell – Delete files older than x days

  ###FUNCTION TO DELETE OLD FILESfunction deleteOldFiles([int]$numberOfDays = $(throw "Specify the number of days")){$Now = Get-Date$TargetFolder = “C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup”$LastWrite = $Now.AddDays(-$numberOfDays)$Files = get-childitem $TargetFolder -include *.bak, *.x86 -recurse | Where {$_.LastWriteTime -le “$LastWrite”} foreach ($File in $Files){ write-host “Deleting File $File” -foregroundcolor “Red”; Remove-Item $File | out-null} }deleteOldFiles(3)

Powershell xcopy for file backup

A handy powershell script for xcopying data – useful for database backups that need copying to tape: function xCopy([string]$src = $(throw "Specify the source directory"),[string]$dest = $(throw "Specify the destination diirectory")){$src = $src -replace '\*$'if (test-path $dest){switch -regex ($src){'\\$' {$src = "$src*"; break}'\w$' {$src = "$src\*"; break}default {break}}}copy-item $src $dest -recurse -force}xCopy "C:\Source Folder\Location" "\\servername\foldershare\valid... Continue Reading →

A WordPress.com Website.

Up ↑