Script Resource

Viewing 1 reply thread
  • Author
    Posts
    • #182115
      Participant
      Topics: 41
      Replies: 56
      Points: 119
      Rank: Participant

      Hi,

      So I have been having an issue executing a script within a remote session. I’ve posted this on the other channel but can’t get it working. So thinking it might not be possible. So im hoping i can find a work around by use DSC.

      I have a ps1 that triggers a SQL restore, i want to execute this script via the script resource in DSC, but i stuggling to understand the get-script,test-script set-script

      Script ScriptExample
      {
      SetScript = {
      $password = ConvertTo-SecureString "************" -AsPlainText -Force
      $Cred = New-Object System.Management.Automation.PSCredential ('*********', $password)
      Start-Sleep -Seconds 15
      Start-Job -Credential $Cred -ScriptBlock { C:\WindowsAzure\***********\**************\RestoreDB.ps1 }
      }
      TestScript = { Test-Path "C:\TempFolder\TestFile.txt" }
      GetScript = { @{ Result = (Get-Content C:\TempFolder\TestFile.txt) } }
      }

       

    • #182556
      Senior Moderator
      Topics: 9
      Replies: 1309
      Points: 4,781
      Helping Hand
      Rank: Community Hero

      which is that thread in other channel, DSC wont be a good workaround here.

Viewing 1 reply thread
  • The topic ‘Script Resource’ is closed to new replies.