Script Resource

This topic contains 1 reply, has 2 voices, and was last updated by

Senior Moderator
1 week ago.

  • Author
  • #182115

    Topics: 39
    Replies: 54
    Points: 89
    Rank: Member


    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: 8
    Replies: 1085
    Points: 3,651
    Helping Hand
    Rank: Community Hero

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

You must be logged in to reply to this topic.