Notice
Recent Posts
Recent Comments
Link
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

감사합니다.

Powershell : Invoke-Command 예제, diskspd 실행하기 본문

카테고리 없음

Powershell : Invoke-Command 예제, diskspd 실행하기

springjunny 2018. 2. 9. 13:07

시나리오

클러스터 노드에서 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