Quantcast
Viewing all articles
Browse latest Browse all 21067

Re: how to input 'y' or 'yes' with powershell script to NCM

Hello

thanks for your your quick response :-)

i will using following powershell script for the device ios upgrading

give me an idea for input the 'y' command to the device plz

 

========================================================

#Prep File

$File = "C:\file.txt"

 

 

$hostname = "127.0.0.1"

$username = "admin"

$password = New-Object System.Security.SecureString

$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password

 

 

$swis = Connect-Swis -v2 -host $hostname -cred $cred

 

 

$ip=read-host "Enter any IP Address"

 

 

$nodeId = get-swisdata $swis "SELECT NodeID FROM Cirrus.Nodes WHERE AgentIP='$ip'"

 

 

$script ="install all kickstart bootflash:n3000-uk9-kickstart.6.0.2.U3.0.709.bin system bootflash:n3000-uk9.6.0.2.U3.0.709.bin"  <--- will be this command executed

 

 

$nodeIdList = New-Object -TypeName "System.Guid[]" 1

$nodeIdList[0] = $nodeId

 

 

Invoke-SwisVerb $swis Cirrus.ConfigArchive Execute @($nodeIdList, $script, $username) | Out-Null

 

 

$transferID = "{$nodeId}:${username}:ExecuteScript"

 

 

do {

    Start-Sleep -Seconds 1

    $status = Get-SwisData $swis "SELECT T.Status, T.Error FROM Cirrus.TransferQueue T WHERE T.TransferID=@transfer" @{transfer=$transferID}

    #Write-Host $status.Status

}

while (($status.Status -ne 'Complete') -and (-not $status.Error))

 

 

$output = Get-SwisData $swis "SELECT T.Log FROM Cirrus.TransferQueue T WHERE T.TransferID=@transfer" @{transfer=$transferID}

 

 

write-host $output

 

 

 

 

$output | Out-File $File

 

 

Write-Host "Process Completed!!"


Viewing all articles
Browse latest Browse all 21067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>