감사합니다.
Powershell : Invoke-Command 예제, diskspd 실행하기 본문
시나리오
클러스터 노드에서 diskspd 명령어 실행하기
param(
[Parameter(Mandatory =$true)]
$b,
[Parameter(Mandatory =$true)]
[int[]] $t,
[Parameter(Mandatory =$true)]
[int[]] $o,
[Parameter(Mandatory =$true)]
[int[]] $w,
[int] $d,
[Parameter(Mandatory =$true)]
[ValidateSet('r','s','si')]
[string[]] $io,
)
$command= " -d$($d)" + " -o$($o)" + " -b$($b)" + " -w$($w)" + " -t$($t)" + " -$io"
$nodes = Get-ClusterNode
foreach($node in $nodes){
$session = New-PSSession -ComputerName $node.name
$password = convertto-securestring "12345678" -asplaintext -force
$user = "administrator"
$credential = New-Object System.Management.Automation.PSCredential($user,$password)
$Runscript = {
Param (
$commands
)
$runcommand = "c:\diskspd.exe -Z20M -h -D -L -W10 " + $commands+ " C:\testfile.dat"
$runcommand | Out-File "C:\diskspd.ps1"
}
Invoke-Command –ComputerName $node.name -ScriptBlock $Runscript -ArgumentList $command