Windows Powershell through Jenkins RRS feed

  • Question

  • Hi ,

    Please help me for resolving this : I need to run this script on Remote machine through Jenkins. Please re arrange this and help me.

    $newline = @()


    [Array]$computernames = $env:computernames


    $computernames = $computernames.trim()


    $computernames1 = $computernames -split "`n`r|`r |`n"


    foreach($computer in $computernames1) {

    #Write-host "My selected computer is $computer"


    Start-Process powershell -Verb runAs

    $result = Stop-Service healthservice

    Stop-Service wuauserv

    ren C:\Windows\SoftwareDistribution SoftwareDistribution.old

    Start-Service wuauserv

    $newline += $result



    Wednesday, August 21, 2019 7:32 AM

All replies