Creating a script to restart devices on a specific network and add some notification or iteration variable that lets me know they have been restarted and powershell is available to be leveraged. However, I can't even get the most basic of workflow to run as I expect it to.
I am getting no error messages, but at the same time nothing is happening so I have no way to even begin to understand why it isn't working. Any insight is greatly appreciated.
Import-Module PSWorkflow
#Get list of workstation IP Addresses on the 87 VLAN
[System.Collections.ArrayList]$NetScan = get-content -path C:\temp\NetScan.log
Workflow Restart87Network{
Foreach -parallel ($ComputerIP in $NetScan)
{
Restart-Computer -PSComputerName $ComputerIP -force -wait -for powershell;
$ComputerIP
}
}
Restart87Network
Short and sweet just for testing to see if it is working. When it runs it doesn't restart the computers that are in the Array. Doesn't throw any error messages, doesn't restart the devices in the array, and the $ComputerIP does not list the IP addresses that are held in that variable.
Maybe I am doing something wrong, or just overlooking something, but everything else I test works as I expect it to except this.
Workflows are definitely working because putting '$var + 1' in the workflow and calling $Var outside of it I get the expected result and other basic commands are working as well. I know I can just use foreach without a workflow and have all the devices restarted, but I want to monitor each one to see when powershell is back up so that I can continue executing a script after. I am currently on Powershell 5.1 so I believe my parallel options are limited.
-ComputerName, not-PSComputerName, maybe try fixing that.