Forum Discussion
Brahmaiah
Feb 21, 2020Brass Contributor
How to run Powershell command in Loop
Hi, I am new to Powershell script and Need your help on below requirement. I am have powershell script displaying last last 3 commands and output of my powershell script. Below last 3 com...
- Feb 21, 2020
Brahmaiah You can use Foreach and set the lock for each member. Let me know if you have any questions.
$FinalResource = $FinalResource1 | Where-Object{$_.ResourceType -ne $MetricType} Write-Output $FinalResource $Counter = $FinalResource.count Foreach($Item in $FinalResource) { Write-Host "($Counter) Locking Resource: $($Item.Name)" New-AzResourceLock -LockLevel CanNotDelete -LockName Delete_Lock -ResourceName $Item.Name -ResourceType $Item.ResourceType -ResourceGroupName $Item.ResourceGroupName $Counter-- }
velaninfoservices
Jun 08, 2021Copper Contributor
How To Manage Windows Processes With PowerShell?
Learn More: https://velaninfo.com/rs/techtips/windows-process-with-powershell/
Learn More: https://velaninfo.com/rs/techtips/windows-process-with-powershell/