cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
359
Views
0
Helpful
1
Replies

Powershell Script waiting on Switch Reboot

Bruen11
Level 1
Level 1

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 

1 Reply 1

balaji.bandi
Hall of Fame
Hall of Fame

is this working normal condition ? or never worked ?

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help