{"id":17716,"date":"2007-05-18T14:01:21","date_gmt":"2007-05-18T22:01:21","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/powershell\/?p=17716"},"modified":"2019-05-16T14:06:15","modified_gmt":"2019-05-16T22:06:15","slug":"microsoft-compute-cluster-now-has-a-powershell-provider-and-cmdlets","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/microsoft-compute-cluster-now-has-a-powershell-provider-and-cmdlets\/","title":{"rendered":"Microsoft Compute Cluster now has a PowerShell Provider and Cmdlets"},"content":{"rendered":"<p>Today the Compute Cluster group announced the release of their Tool Pack HERE. This includes a monitoring tool, a ping\/pong diagnostic tool and (drum roll please\u2026\u2026) a PowerShell Snap-in which provides a provider and a set of commands. I really like what they have done. I&#8217;ve include the text of their about file so that you can see for yourself.\nHere is a test &#8211; take a look at the file below but don&#8217;t read any of the text \u2013 just look at the command examples.\nSee if you can figure out what it is doing. Now go back and read it again with the text and ask yourself whether the text really added a lot more to your understanding.\nLet me be very quick to state that I&#8217;m NOT making the case against documentation. Heavens no! Great documentation is super important. What I&#8217;m trying to point out is the self-documenting nature of PowerShell scripts. This is why we are so hard core about the naming guidelines.\nAt some point, the mess is going to hit the fan and you are going to be under lots of pressure to figure out what a script is doing and modify it to meet some new requirement. We&#8217;ve all been there before, trying to figure out what the heck a script is doing. Now imagine that same scenario but the script is written in PowerShell. We are working our butts off to make sure that that is a good experience for you.\nBTW (I&#8217;m going to keep reminding you of this) you all play a super important role in making this come true. When you see anyone produce Cmdlets or Scripts which don&#8217;t conform to the naming guidelines \u2013 you should scream! Chaos is the natural state of things and everyone is going to argue that their world is &#8220;special&#8221; and they need their own terms. If you accept that, then we&#8217;ll end up with yet another incoherent mess. What those people should do is to use the standard terms and then define aliases from their &#8220;special&#8221; terms to the standard terms.\nAnyway \u2013 I love what they have done with PowerShell. It&#8217;s another example of a team delivering a great experience using PowerShell.\nThis train keeps gathering steam! SNOOPY DANCE!\nJeffrey Snover [MSFT]\nWindows Management Partner Architect\nVisit the Windows PowerShell Team blog at: http:\/\/blogs.msdn.com\/PowerShell\nVisit the Windows PowerShell ScriptCenter at: http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\nTOPIC CCPPSH<\/p>\n<p>SHORT DESCRIPTION \nMicrosoft Compute Cluster Pack Snap-in for Windows PowerShell<\/p>\n<p>LONG DESCRIPTION<\/p>\n<p>The Compute Cluster Pack (CCP) snap-in lets you view and manage Compute Cluster \nPack features in Windows PowerShell. The snap-in adds Compute Cluster Pack \ncmdlets and a CCP Windows PowerShell provider that lets you view and navigate \ncluster data in Windows PowerShell. <\/p>\n<p>INSTALL THE SNAPIN<\/p>\n<p>To add the Compute Cluster Pack (CCP) snap-in to Windows PowerShell, at the \nWindows PowerShell prompt, type:<\/p>\n<p>Add-PSSnapin CCPSnapIn<\/p>\n<p>To display CCP data correctly, load the CCP type file and formatting files, at \nthe Windows PowerShell prompt, type:<\/p>\n<p>Update-TypeData -PrependPath &#8220;ccp.ps1xml&#8221; \nUpdate-FormatData -PrependPath &#8220;ccp.format.ps1xml&#8221;<\/p>\n<p>These commands affect only the current Windows PowerShell console. To add the \nfiles to all Windows PowerShell consoles, add these commands to your Windows \nPowerShell profile.<\/p>\n<p>1. To determine whether you have a Windows PowerShell profile, at the Windows \nPowerShell prompt, type:<\/p>\n<p>test-path $profile<\/p>\n<p>&#8220;True&#8221; means that you have a profile. &#8220;False&#8221; means that you do not. If \n&#8220;True&#8221;, skip to step 3.<\/p>\n<p>2. To create a Windows PowerShell profile, at the Windows PowerShell prompt, \ntype:<\/p>\n<p>new-item -type file -path $profile -force<\/p>\n<p>The $profile variable is a built-in variable that stores the path to your \nWindows PowerShell profile.<\/p>\n<p>3. To open the profile in Notepad, type:<\/p>\n<p>notepad $profile <\/p>\n<p>4. Copy and paste the commands into your profile. The new profile is \neffective when you restart Windows PowerShell.<\/p>\n<p>NEW FEATURES<\/p>\n<p>The CCP snap-in adds two features to Windows PowerShell:<\/p>\n<p>&#8212; CCPProvider, a Windows PowerShell provider that lets you browse and navigate \ncluster data. (For information about Windows PowerShell providers, type \n&#8220;get-help about_provider&#8221;.)<\/p>\n<p>&#8212; A set of CCP cmdlets for Windows PowerShell, including Get-Node, Get-Job, \nGet-Task, New-Job, and New-Task.<\/p>\n<p>NAVIGATING CCP DATA IN WINDOWS POWERSHELL<\/p>\n<p>You can use the features added by the CCP snap-in to manage CCP cluster in \nWindows PowerShell. <\/p>\n<p>The following command creates a new Windows PowerShell drive called CCP: and \nmounts a cluster onto the Windows PowerShell CCP: drive. The cluster is \nidentified by its head node, which is stored in the value of the \nCCP_SCHEDULER environment variable. <\/p>\n<p>New-PSDrive -name CCP -provider CCPProvider -root $Env:CCP_SCHEDULER<\/p>\n<p>After the drive is created, you can switch to this drive and access the data \nas though it were located in the drive.<\/p>\n<p>For example, the following command changes to the new CCP: drive. It uses the \n&#8220;cd&#8221; alias for the Set-Location cmdlet, and the &#8220;dir&#8221; alias for the \nGet-Childitem cmdlet. <\/p>\n<p>PS c:\\> cd ccp: \nPS ccp:\\> dir nodes<\/p>\n<p>Name Status Proc Idle \n&#8212;- &#8212;&#8212; &#8212;- &#8212;-\nHPC-HN-01 Pend&#8230; 2 2 \nHPC-CN-01 Ready 2 2 \n&#8230; \nHPC-CN-08 Ready 1 1<\/p>\n<p>PS ccp:\\> dir jobs <\/p>\n<p>ID SubmitBy Name Status Priority \n&#8212; &#8212;&#8212;&#8211; &#8212;- &#8212;&#8212; &#8212;&#8212;&#8211;\n96 CCP\\USER1 Job 1 Failed Normal<\/p>\n<p>EXAMPLES: USING CCP CMDLETS IN WINDOWS POWERSHELL<\/p>\n<p>The CCP cmdlets lets you manage clusters in Windows PowerShell. All of the CCP \ncmdlets have a Scheduler parameter that specifies the head node that the command \naffects. <\/p>\n<p>If the Scheduler parameter is not included in the command, the CCP cmdlets use \nthe value of the CCP_SCHEDULER environment variable ($ENV:CCP_SCHEDULER)as the \ndefault head node. You can use the Set-Content cmdlet to change the value of \nCCP_SCHEDULER. <\/p>\n<p>For help with any cmdlet, at the Windows PowerShell prompt, type:<\/p>\n<p>get-help <cmdlet-name>&#8221;<\/p>\n<p>For example:<\/p>\n<p>get-help get-node<\/p>\n<p>Get-Node: Gets all of the nodes under the head node.<\/p>\n<p>This command uses the Get-Node cmdlet to list all of the nodes under the head \nnode.<\/p>\n<p>PS ccp:\\jobs> get-node <\/p>\n<p>Name Status Proc Idle \n&#8212;- &#8212;&#8212; &#8212;- &#8212;- \nHPC-DEMO-CN-11 Pend&#8230; 2 2 \nHPC-DEMO-CN-12 Pend&#8230; 2 2 \nHPC-DEMO-CN-13 Pend&#8230; 2 2 \nHPC-DEMO-CN-14 Pend&#8230; 2 2 \nHPC-DEMO-CN-15 Pend&#8230; 2 2 \nHPC-DEMO-HN-01 Pend&#8230; 2 2<\/p>\n<p>Enable-Node: Approves any pending nodes under the head node. This changes the \nstatus of the node from Pending to Paused. Use the Resume-Node cmdlet to make \nthem ready.<\/p>\n<p>The first command in this example uses the Get-Node cmdlet to get all of the \nnodes under the head node. Then, it uses the pipeline operator (|) to send the \nresults of the Get-Node command to the Enable-Node cmdlet, which approves the \npending nodes. As a result, the nodes that were in a Pending status are now in a \nPaused status.<\/p>\n<p>The second command uses the Get-Node cmdlet to display the updated status of the \nnodes.<\/p>\n<p>PS ccp:\\jobs> get-node | enable-node \nPS ccp:\\jobs> get-node<\/p>\n<p>Name Status Proc Idle \n&#8212;- &#8212;&#8212; &#8212;- &#8212;- \nHPC-DEMO-CN-11 Paused 2 2 \nHPC-DEMO-CN-12 Paused 2 2 \nHPC-DEMO-CN-13 Paused 2 2 \nHPC-DEMO-CN-14 Paused 2 2 \nHPC-DEMO-CN-15 Paused 2 2 \nHPC-DEMO-HN-01 Paused 2 2<\/p>\n<p>Resume-Node: Resumes any paused nodes under the head node. This changes their \nstatus from Paused to Ready. Because newly-enabled nodes are paused, you need to \nuse this cmdlet to change their status to Ready.<\/p>\n<p>The first command in this example uses the Get-Node cmdlet to get all of the \nnodes under the head node. Then, it uses the pipeline operator (|) to send the \nresults of the Get-Node command to the Resume-Node cmdlet, which enables any \npaused nodes. As a result, the nodes that were in a Paused status are now in a \nReady status.<\/p>\n<p>The second command uses Get-Node to display the updated status.<\/p>\n<p>PS ccp:\\jobs> get-node | resume-node \nPS ccp:\\jobs> get-node<\/p>\n<p>Name Status Proc Idle \n&#8212;- &#8212;&#8212; &#8212;- &#8212;- \nHPC-DEMO-CN-11 Ready 2 2 \nHPC-DEMO-CN-12 Ready 2 2 \nHPC-DEMO-CN-13 Ready 2 2 \nHPC-DEMO-CN-14 Ready 2 2 \nHPC-DEMO-CN-15 Ready 2 2 \nHPC-DEMO-HN-01 Ready 2 2<\/p>\n<p>You can save a collection of nodes in a variable and use array notation to view\nand manage the node objects. (For more information, type &#8220;get-help \nabout_shell_variable&#8221; and &#8220;get-help about_array&#8221;.)<\/p>\n<p>This command uses the assignment operator (=) to save the results of the \nGet-Node command in the $a variable.<\/p>\n<p>PS ccp:\\> $a = get-node<\/p>\n<p>This command displays the first node (element 0) in the $a variable.<\/p>\n<p>PS ccp:\\> $a[0]<\/p>\n<p>Name Status Proc Idle \n&#8212;- &#8212;&#8212; &#8212;- &#8212;- \nHPC-DEMO-CN-11 Ready 2 2<\/p>\n<p>You can use the Windows PowerShell filtering cmdlets, such as Select-Object, \nWhere-Object, and Sort-Object, to manage CCP data. <\/p>\n<p>The first command uses the Select-Object to assign only the first two nodes in \nthe collection to the $a variable. Because the pipeline operator (|) has \nprecedence over the assignment operator (=), the &#8220;get-node | select-object \nfirst 2&#8221; part of the command is completed first and the results are assigned \nto the $a variable.<\/p>\n<p>The second command displays the two nodes that are stored in $a.<\/p>\n<p>PS ccp:\\> $a = get-node | select-object -first 2 \nPS ccp:\\> $a<\/p>\n<p>Name Status Proc Idle \n&#8212;- &#8212;&#8212; &#8212;- &#8212;- \nHPC-DEMO-CN-11 Ready 2 2 \nHPC-DEMO-CN-12 Ready 2 2<\/p>\n<p>Suspend-Node: Suspends ready nodes. This changes their status from Ready to \nPaused.<\/p>\n<p>The following command uses the Select-Object cmdlet and its First parameter to \nselect only the first three nodes returned by Get-Node. The second pipeline \noperator in the command sends the objects representing the three nodes to \nSuspend-Node, which pauses the nodes. <\/p>\n<p>The second Get-Node command confirms that Suspend-Node affected only the first \nthree nodes.<\/p>\n<p>PS ccp:\\> get-node | select-object -first 3 | Suspend-Node \nPS ccp:\\> get-node<\/p>\n<p>Name Status Proc Idle \n&#8212;- &#8212;&#8212; &#8212;- &#8212;- \nHPC-DEMO-CN-11 Paused 2 2 \nHPC-DEMO-CN-12 Paused 2 2<\/p>\n<p>Get-Job: Gets all of the jobs on the head node or any nodes under the head node.<\/p>\n<p>This command gets all of the jobs on the default head node, that is, the value \nof the CCP_SCHEDULER parameter. <\/p>\n<p>PS ccp:\\> get-job<\/p>\n<p>ID SubmitBy Name Status Priority \n&#8212; &#8212;&#8212;&#8211; &#8212;- &#8212;&#8212; &#8212;&#8212;&#8211; \n96 CCP\\USER1 Job 1 Failed Normal<\/p>\n<p>Restart-Job: Restarts jobs and returns them to the queue. <\/p>\n<p>This command gets all of the jobs under the head node. It uses the pipeline \noperator (|) to send the jobs to the Restart-Job cmdlet, which restarts any jobs \nthat not started. As a result, a job that had failed is now requeued.<\/p>\n<p>Unlike the Start-Job cmdlet, the Restart-Job cmdlets starts only jobs that were \nstarted, but failed, were cancelled, or were suspended.<\/p>\n<p>PS ccp:\\> get-job | restart-job \nPS ccp:\\> get-job<\/p>\n<p>ID SubmitBy Name Status Priority \n&#8212; &#8212;&#8212;&#8211; &#8212;- &#8212;&#8212; &#8212;&#8212;&#8211; \n96 CCP\\USER1 Job 1 Queued Normal<\/p>\n<p>Stop-Job: Stops and cancels jobs.<\/p>\n<p>This command gets all of the jobs under the head node. It uses the pipeline \noperator (|) to send the jobs to the Stop-Job cmdlet, which stops the jobs that \nit receives. As a result, a job that had been queued is now cancelled.<\/p>\n<p>The second command uses Get-Job to display the cancelled jobs.<\/p>\n<p>PS ccp:\\> get-job | stop-job PS ccp:\\> get-job<\/p>\n<p>ID SubmitBy Name Status Priority \n&#8212; &#8212;&#8212;&#8211; &#8212;- &#8212;&#8212; &#8212;&#8212;&#8211; \n96 CCP\\USER1 Job 1 Cancelled Normal<\/p>\n<p>Get-Task: Gets the tasks in one or more jobs.<\/p>\n<p>This command gets the tasks in a job and displays them in order by task ID.<\/p>\n<p>This command uses the Get-Job cmdlet to get the jobs under the head node. It \nuses array notation to select the second job ([1] in a zero-based array). The \npipeline operator (|) sends the job to the Get-Task cmdlet, which gets all of \nthe tasks in the job and sends them to the Sort-Object cmdlet, which sorts them \nin order by task ID.<\/p>\n<p>By default, tasks are displayed in the order that they are discovered.<\/p>\n<p>PS ccp:\\> (get-job)[1] | get-task | sort-object -property id <\/p>\n<p>ID Status Name CommandLine \n&#8212; &#8212;&#8212; &#8212;- &#8212;&#8212;&#8212;&#8211; \n1 Finished CCPDemo 10K Tasks Group 00 echo 1 \n2 Finished CCPDemo 10K Tasks Group 00 echo 2 \n&#8230; \n9998 Queued CCPDemo 10K Tasks Group 09 echo 998 \n9999 Queued CCPDemo 10K Tasks Group 09 echo 999 \n1&#8230; Queued CCPDemo 10K Tasks Group 09 echo 1000<\/p>\n<p>This command gets the tasks in a selected job and uses the Where-Object cmdlet \nto select only the tasks with IDs greater than 500 and less than 530.<\/p>\n<p>The Where-Object command uses the &#8220;$_.&#8221; notation, which refers to the current \nobject in the pipeline. The pipeline operator sends objects down the pipeline \none at a time. The &#8220;$_.&#8221; notation indicates that the operation should be \nperformed on each object as it arrives from the pipeline. When all objects have \nbeen processed, the results are sent down the pipeline to the next cmdlet.<\/p>\n<p>PS ccp:\\> (get-job)[1] | get-task | where-object { ($_.id -gt 500) \u00a8Cand \n($_.id &#8211; lt 530)}<\/p>\n<p>ID Status Name CommandLine \n&#8212; &#8212;&#8212; &#8212;- &#8212;&#8212;&#8212;&#8211; \n521 Queued CCPDemo 10K Tasks Group 00 echo 521 \n522 Queued CCPDemo 10K Tasks Group 00 echo 522 \n&#8230; \n529 Queued CCPDemo 10K Tasks Group 00 echo 529 \n501 Finished CCPDemo 10K Tasks Group 00 echo 501 \n502 Finished CCPDemo 10K Tasks Group 00 echo 502 \n&#8230; \n520 Finished CCPDemo 10K Tasks Group 00 echo 520<\/p>\n<p>Stop-Task: Stops one or more tasks. <\/p>\n<p>The first command in this series stops any queued tasks in a selected job that \nhave IDs between 500 and 530 (exclusive). It uses the Get-Job cmdlet to get the \njobs in the second job in the system (job [1] in a zero-based array) and the \nGet-Task cmdlet to get the tasks in that job. It uses the Where-Object cmdlet to \nselect tasks with a status of &#8220;queued&#8221; and a task ID between 500 and 530. It \nsends the selected tasks to the Stop-Task cmdlet, which stops them.<\/p>\n<p>The second command displays the tasks with task IDs between 500 and 530. The \nresults show that the affected tasks are cancelled.<\/p>\n<p>PS ccp:\\> (get-job )[1] | get-task | where-object { ($_.id -gt 500) -and \n($_.id &#8211; lt 530) -and ($_.status -eq &#8220;queued&#8221;)} | stop-task <\/p>\n<p>PS ccp:\\> (get-job)[1] | get-task | where-object { ($_.id -gt 500) -and \n($_.id &#8211; lt 530)}<\/p>\n<p>ID Status Name CommandLine \n&#8212; &#8212;&#8212; &#8212;- &#8212;&#8212;&#8212;&#8211; \n501 Finished CCPDemo 10K Tasks Group 00 echo 501 \n502 Finished CCPDemo 10K Tasks Group 00 echo 502 \n&#8230; \n520 Finished CCPDemo 10K Tasks Group 00 echo 520 \n521 Cancelled CCPDemo 10K Tasks Group 00 echo 521 \n&#8230; \n528 Cancelled CCPDemo 10K Tasks Group 00 echo 528 \n529 Cancelled CCPDemo 10K Tasks Group 00 echo 529<\/p>\n<p>Restart-Task: Restarts (or starts) tasks. <\/p>\n<p>The first command in this series starts the tasks in a selected job that have \nIDs between 500 and 530 (exclusive) and a status of &#8220;Cancelled&#8221;. It uses the \nGet-Job cmdlet to get the jobs in the second job in the system (job [1] in a \nzero-based array) and the Get-Task cmdlet to get the tasks in that job. It uses \nthe Where-Object cmdlet to select tasks with a status of &#8220;cancelled&#8221; and a task \nID between 500 and 530. It sends the selected tasks to the Restart-Task cmdlet, \nwhich starts them.<\/p>\n<p>The second command displays the tasks with task IDs between 500 and 530. The \nresults show that the affected tasks are requeued.<\/p>\n<p>PS ccp:\\> (get-job)[1] | get-task | where-object { ($_.id -gt 500) -and \n($_.id &#8211; lt 530) -and ($_.status -eq &#8220;cancelled&#8221;)} | Restart-Task\nPS ccp:\\> (get-job)[1] | get-task | where-object { ($_.id -gt 500) -and \n($_.id &#8211; lt 530)}<\/p>\n<p>ID Status Name CommandLine \n&#8212; &#8212;&#8212; &#8212;- &#8212;&#8212;&#8212;&#8211; \n501 Finished CCPDemo 10K Tasks Group 00 echo 501 \n&#8230; \n519 Finished CCPDemo 10K Tasks Group 00 echo 519 \n520 Finished CCPDemo 10K Tasks Group 00 echo 520 \n521 Queued CCPDemo 10K Tasks Group 00 echo 521 \n522 Queued CCPDemo 10K Tasks Group 00 echo 522 \n&#8230; \n529 Queued CCPDemo 10K Tasks Group 00 echo 529<\/p>\n<p>New-Job: Creates a new job.<\/p>\n<p>The first command in this series creates a new job and stores it in the $j \nvariable. <\/p>\n<p>The second command names the job &#8220;CCPDemo&#8221;. It uses the <object>.<property> \nformat to access the Name property of the job object in the $j variable. It uses \nthe assignment operator (=) to assign the &#8220;CCPDemo&#8221; value to the Name property \nof the job object in the $j variable. <\/p>\n<p>The third command uses the Format-List cmdlet to display the properties of \nnewly-created job object as a list. <\/p>\n<p>PS ccp:\\> $j = new-job \nPS ccp:\\> $j.Name = &#8220;CCPDemo&#8221;\nPS ccp:\\> $j | format-list <\/p>\n<p>AllocatedNodes : \nAskedNodes : \nCreateTime : 12\/31\/9999 11:59:59 PM \nEndTime : 12\/31\/9999 11:59:59 PM \nExtendedJobTerms : {} \nId : 0 \nIsBackfill : False \nIsExclusive : True \nMaximumNumberOfProcessors : 1 \nMinimumNumberOfProcessors : 1 \nErrorMessage : \nName : CCPDemo \nSubmittedBy : \nPriority : \nNormal Project : \nRunUntilCanceled : False \nRuntime : Infinite \nStartTime : 12\/31\/9999 11:59:59 PM \nSoftwareLicense : \nStatus : NotSubmitted \nSubmitTime : 12\/31\/9999 11:59:59 PM \nTasks : {} \nUser : \nTaskCount : 0 \nTimestamp :<\/p>\n<p>This command limits the CCPDemo job to four processors. It uses the \n<object>.<property> format to access the MaximumNumberOfProcessors property of \nthe job object in the $j variable, and an assignment statement to assign a value \nof &#8220;4&#8221; to the property.<\/p>\n<p>PS ccp:\\> $j.MaximumNumberOfProcessors = 4<\/p>\n<p>New Task: Creates a new task in a job.<\/p>\n<p>The first command in this series uses the New-Task cmdlet to creates a new task. \nThen, it stores the new task in the $t1 variable. <\/p>\n<p>The second command uses the <object>.<property> format to access the Name \nproperty of the new task object in the $t variable. Then, it assigns the &#8220;t1&#8221; \nname to the task. <\/p>\n<p>The third command uses the object>.<property> format to access the CommandLine \nproperty of the task object in the $t1 variable. Then, it assigns the &#8220;t1cmd&#8221; \nvalue to the CommandLine property. <\/p>\n<p>PS ccp:\\> $t1 = new-task \nPS ccp:\\> $t1.Name = &#8220;t1&#8221; \nPS ccp:\\> $t1.CommandLine = &#8220;t1cmd&#8221;<\/p>\n<p>This series of commands is much like the previous one. It creates a new task and \nstores it in the $t2 variable; it assigns the name, &#8220;t2&#8221; to the task and the \nvalue &#8220;t2cmd&#8221; to the CommandLine property.<\/p>\n<p>PS ccp:\\> $t2 = new-task \nPS ccp:\\> $t2.Name = &#8220;t2&#8221; \nPS ccp:\\> $t2.CommandLine = &#8220;t2cmd&#8221; <\/p>\n<p>Add-Task: Adds a task to a job. The task and the job must exist before they are \nassociated.<\/p>\n<p>The first command uses the Add-Task cmdlet to add the tasks stored in the $t1 \nand $t2 variables to the job stored in the $j variable. It uses the Job \nparameter to specify the job. <\/p>\n<p>The second command uses the Format-List cmdlet to display the properties of job \nobject in a list. It shows that the maximum number of processors was changed to \n4, and that the new tasks are added.<\/p>\n<p>PS ccp:\\> $t,$t2 | add-task -job $j\nPS ccp:\\> $j | format-list<\/p>\n<p>AllocatedNodes :\nAskedNodes :\nCreateTime : 12\/31\/9999 11:59:59 PM\nEndTime : 12\/31\/9999 11:59:59 PM\nExtendedJobTerms : {}\nId : 0\nIsBackfill : False\nIsExclusive : True\nMaximumNumberOfProcessors : 4 \nMinimumNumberOfProcessors : 1\nErrorMessage :\nName : CCPDemo\nSubmittedBy :\nPriority : Normal\nProject :\nRunUntilCanceled : False\nRuntime : Infinite\nStartTime : 12\/31\/9999 11:59:59 PM\nSoftwareLicense :\nStatus : NotSubmitted\nSubmitTime : 12\/31\/9999 11:59:59 PM\nTasks : {t1, t2name} \nUser :\nTaskCount : 2\nTimestamp :<\/p>\n<p>Start-Job: Submits the job for execution.<\/p>\n<p>The first command starts the job stored in the $j variable by piping the \nvariable to the cmdlet. After it is started, the status is &#8220;queued&#8221;. <\/p>\n<p>The second command gets the jobs under the head node. In this case, the job \nstored in the $j variable is the only one.<\/p>\n<p>PS ccp:\\> $j | start-job\nPS ccp:\\> get-job<\/p>\n<p>ID SubmitBy Name Status Priority\n&#8212; &#8212;&#8212;&#8211; &#8212;- &#8212;&#8212; &#8212;&#8212;&#8211;\n&#8230;\n6 DOMAIN1\\User1 CCPDemo Queued Normal<\/p>\n<p>This command uses the Get-Task cmdlet to display the tasks in the newly started \njob. It shows that the tasks in the job are queued when the job is started.<\/p>\n<p>PS ccp:\\> get-job)[5] | get-task\nID Status Name CommandLine\n&#8212; &#8212;&#8212; &#8212;- &#8212;&#8212;&#8212;&#8211;\n1 Queued t1 t2cmd\n2 Queued t2 t2cmd<\/p>\n<p>Using Variables and Arrays with CCP Data<\/p>\n<p>This command saves the result of a Get-Node command in the $a variable. As a \nresult, $a contains objects representing all of the nodes under the head node.<\/p>\n<p>PS ccp:\\> $a = get-node\nPS ccp:\\> $a<\/p>\n<p>Name Status Proc Idle\n&#8212;- &#8212;&#8212; &#8212;- &#8212;-\nHPC-DEMO-CN-11 Ready 2 2\nHPC-DEMO-CN-12 Ready 2 2\nHPC-DEMO-CN-13 Ready 2 2\nHPC-DEMO-CN-14 Ready 2 2\nHPC-DEMO-CN-15 Ready 2 2\nHPC-DEMO-HN-01 Ready 2 2<\/p>\n<p>The Get-Node command actually gets an array of objects, each of which represents \none node. You can use standard array notation to access the items in the array. <\/p>\n<p>This command uses array notation to access the first node object in the $a \nvariable. <\/p>\n<p>PS ccp:\\> $a[0]<\/p>\n<p>Name Status Proc Idle\n&#8212;- &#8212;&#8212; &#8212;- &#8212;-\nHPC-DEMO-CN-11 Ready 2 2<\/p>\n<p>You can use the cmdlets that come with Windows PowerShell to manipulate the CCP \ndata. <\/p>\n<p>This command uses the Select-Object cmdlet and its First parameter to select \nonly the first two nodes returned by Get-Node. The results are stored in the $a \nvariable.<\/p>\n<p>The parentheses in this command have no effect. They are added to show that the \nGet-Node and Select-Object commands are completed before the result is stored in \nthe $a variable. (The pipeline operator takes precedence over the assignment \noperator.)<\/p>\n<p>PS ccp:\\> $a = (get-node | select-object -first 2)\nPS ccp:\\> $a<\/p>\n<p>Name Status Proc Idle\n&#8212;- &#8212;&#8212; &#8212;- &#8212;-\nHPC-DEMO-CN-11 Ready 2 2\nHPC-DEMO-CN-12 Ready 2 2<\/p>\n<p>This command uses the Suspend-Node cmdlet, which pauses ready nodes. <\/p>\n<p>The command uses the Select-Object cmdlet and its First parameter to select only \nthe first three nodes returned by Get-Node. The second pipeline operator in the \ncommand sends the objects representing the three nodes to Suspend-Node, which \npauses the nodes. <\/p>\n<p>The second Get-Node command confirms that Suspend-Node affected only the first \nthree nodes.<\/p>\n<p>PS ccp:\\> get-node | select-object -first 3 | Suspend-Node # node pause\nPS ccp:\\> get-node<\/p>\n<p>Name Status Proc Idle\n&#8212;- &#8212;&#8212; &#8212;- &#8212;-\nHPC-DEMO-CN-11 Paused 2 2\nHPC-DEMO-CN-12 Paused 2 2\nHPC-DEMO-CN-13 Paused 2 2\nHPC-DEMO-CN-14 Ready 2 2\nHPC-DEMO-CN-15 Ready 2 2\nHPC-DEMO-HN-01 Ready 2 2<\/p>\n<p>This command uses the Where-Object cmdlet to select only the paused nodes from \nthe array that Get-Node gets. The paused nodes are sent to the Resume-Node \ncmdlet, which changes their status from &#8220;paused&#8221; to &#8220;ready.&#8221;<\/p>\n<p>The pipeline operator sends objects down the pipeline one at a time. The Where-\nObject command uses the &#8220;$_.&#8221; symbol, which refers to the current object sent \ndown the pipeline. The operation that it specifies is performed on each object \nas it arrives. When all objects have been processed, the results are sent to the \nnext cmdlet.<\/p>\n<p>PS ccp:\\> get-node | where-object {$_.status -eq &#8220;paused&#8221;} | Resume-Node\nPS ccp:\\> get-node<\/p>\n<p>Name Status Proc Idle\n&#8212;- &#8212;&#8212; &#8212;- &#8212;-\nHPC-DEMO-CN-11 Ready 2 2\nHPC-DEMO-CN-12 Ready 2 2\nHPC-DEMO-CN-13 Ready 2 2\nHPC-DEMO-CN-14 Ready 2 2\nHPC-DEMO-CN-15 Ready 2 2\nHPC-DEMO-HN-01 Ready 2 2<\/p>\n<p>SEE ALSO \nFor information about individual Cmdlets, use the help alias (for the \nget-help Cmdlet) followed by the Cmdlet name. For example, to view information \nabout the get-node Cmdlet, Enter the following command:<\/p>\n<p>help get-node<\/p>\n<p>To get a full list of Cmdlets for CCP, enter the following command:<\/p>\n<p>get-command -pssnapin CCPSnapIn<\/p>\n<p>To change the value of the environment set CCP_SCHEDULER, use this command:<\/p>\n<p>set-content env:CCP_SCHEDULER your_scheduler<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today the Compute Cluster group announced the release of their Tool Pack HERE. This includes a monitoring tool, a ping\/pong diagnostic tool and (drum roll please\u2026\u2026) a PowerShell Snap-in which provides a provider and a set of commands. I really like what they have done. I&#8217;ve include the text of their about file so that [&hellip;]<\/p>\n","protected":false},"author":685,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-17716","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>Today the Compute Cluster group announced the release of their Tool Pack HERE. This includes a monitoring tool, a ping\/pong diagnostic tool and (drum roll please\u2026\u2026) a PowerShell Snap-in which provides a provider and a set of commands. I really like what they have done. I&#8217;ve include the text of their about file so that [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17716","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/685"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=17716"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17716\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=17716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=17716"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=17716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}