I am trying to continue a powershell script that I am utilizing that will continue my script after picking up the switch has finished rebooting. The way I am doing it now is using a while statement then after continuing to entering password. I get to where it's supposed to send return to wake the switch up and continue entering user/pw but it continues to just enter blank lines as if it's not actually sending enter to begin the next phase of the script. writeThis is write to port.
$reloadingOut = $port.readExisting( )
while( $reloadingOut -notmatch 'User Access Verification' ) {
$addTo = $port.readExisting( )
write-host $addTo
$reloadingOut += $addTo
sleep 2
write-host '- waiting for User Access Verification -'
}
write-host 'FOUND Username'
$lookForPass = writeThis 'admin'
write-host $lookForPass
if( $lookForPass -match 'Password' ) {
write-host 'FOUND Password'
writeThis $adminPass
}
writeThis $sendReturn 5
writeThis $sendReturn 5
writeThis $sendReturn 5
writeThis $sendReturn 5
}
dunkinrunsonyou