The scripts are what i practically use (passwords and names are changed) to do my job. Not all scripts are written to be save for usage in corporate environments (like saving credentials in a script) or otherwise. These are jsut usable snippets. to make my work more easy.

Demo content

Click the pencil-icon to edit content. This is just a demo-text with Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sit amet gravida magna. Proin in porttitor ante. Vestibulum varius pretium libero nec maximus. Nulla ac nulla purus.

Phasellus condimentum vehicula felis, quis porttitor enim aliquet in. Praesent consequat neque eget nisl dictum malesuada. Nam id efficitur arcu. Donec id mauris viverra nibh volutpat dapibus. Vivamus molestie sem urna, commodo laoreet nisl fermentum rutrum. Vivamus maximus, est ac gravida mattis, lacus orci gravida ipsum, non viverra leo ligula iaculis libero. 

New-PerfmonBLGfile

$svr = 'dev001'

$CtrList = @(
'\network interface(microsoft hyper-v network adapter)\packets/sec',
'\network interface(microsoft hyper-v network adapter)\packets received/sec',
'\network interface(microsoft hyper-v network adapter)\packets sent/sec'
)



#1 hour = 3600 samples / sec., 10 min = 600 samples
$MaxSamples = 300
$SampleInterval = 1   
write-debug ('wait {0} maxsamples x {1} interval(sec) = {2} seconds...' -f $maxsamples, $sampleinterval, $maxsamples*$sampleinterval)

Get-Counter -ComputerName $svr -Counter $CtrList -SampleInterval $SampleInterval -MaxSamples $MaxSamples | Export-Counter -Path d:\temp\PerfExample.blg -FileFormat BLG -Force
invoke-item d:\temp\PerfExample.blg

Credentials

$username = 'cn=Paul,ou=development,ou=Users,dc=it-pro,dc=nl'
$password = ConvertTo-SecureString  'MyOhSoSecretPassword' -AsPlainText -Force
 
$cred = new-object -typename System.Management.Automation.PSCredential `
-argumentlist $username, $password
 
#usage:
invoke-command -scriptblock { get-content c:\ -dir } -server dev001 -credentials $cred
this is a demo fragment - formatted with the <pre> tag