Good Morning, Good Afternoon, and Good Evening,
At the moment, I have a script, which I found on the web. I did not right this hence why I am adding the link to give credit to the creator of the script.
http://www.jonathanmedd.net/2010/11/managing-perfmon-data-collector-sets-with-powershell.html
Basically, I just changed the original path of the first line to reflect my environment. I created the two text files; one, which contains a list of performance counters, and two, which contains a list of servers.
With regards to the script, it works as expected as it creates a performance counter on each server. The script however does not create correct counters
This is an example of the counter that it is creating.
"\\urt-s28-sc\\\urt-s28-scP\\urt-s28-scr\\urt-s28-sco\\urt-s28-scc\\urt-s28-sce\\urt-s28-scs\\urt-s28-scs\\urt-s28-sco\\urt-s28-scr\\urt-s28-sc(\\urt-s28-sc*\\urt-s28-sc)\\urt-s28-sc\\\urt-s28-sc%\\urt-s28-sc \\urt-s28-scP\\urt-s28-scr\\urt-s28-sco\\urt-s28-sc"
Another admin created a typeperf performance counter, and in properties they got this, which is correct.
"\Processor(*)\% processor Time
I am not getting what typeperf is doing could someone please take a look at this code, and maybe direct me in a way for me to change the code. I actually have a deadline for this one so any help is welcomed.
This is the code.
$pwd = "C:\Users\jmateo\Desktop\TestProjects"$counters = @(gc $pwd\perfmon_counters.txt) # List of counters one per line
$servers = @(gc $pwd\perfmon_list.txt) # List of remote computers one per line
$frequence = "00:00:30" #hh:mm:ss
$logtype = "tsv" # possibles: bin,bincirc,csv,tsv
$max_duration = "168:00:00" # 7 days
$max_size = "50" # megabytes
$l = $servers.length
$i = 0
foreach ($server in $servers)
{
$counters | % {$_ -replace "", "\\$server"} | sc $pwd\$server.txt
Write-Progress -Activity "Setting up Collections...." -Status "Collection: $i of $l" -PercentComplete (100*$i/$l)
$strCMD1 = 'C:\Windows\System32\logman.exe create counter perf_$server -s $server -si $frequence -cf $pwd\$server.txt -f $logtype -v mmddhhmm -o C:\PerfLogs\log_$server -rf $max_duration -max $max_size -u adminusername adminpassword'
$i++
Invoke-Expression $strCMD1
Start-Sleep -Milliseconds 100
$startprocess = Invoke-WmiMethod -ComputerName $server -Class Win32_Process -Name Create -ArgumentList "logman.exe start perf_$server"
ri $pwd\$server.txt