PowerShell DSC Variables Getting Null after Invoke-Command execute from pwrshell

Welcome Forums DSC (Desired State Configuration) PowerShell DSC Variables Getting Null after Invoke-Command execute from pwrshell

Viewing 1 reply thread
  • Author
    Posts
    • #180905
      Participant
      Topics: 1
      Replies: 1
      Points: -5
      Rank: Member

      <span class="typ">Configuration</span><span class="pln"> setupfilezip<br /></span><span class="pun">{</span><span class="pln"><br />   param </span><span class="pun">(</span><span class="pln">$ComputerName</span><span class="pun">)</span><span class="pln"><br />   $vdirectoryPath </span><span class="pun">=</span> <span class="str">"C:\temp\setupfiles"</span><br />   <span class="typ">Import</span><span class="pun">-</span><span class="typ">DscResource</span> <span class="pun">-</span><span class="typ">ModuleName</span> <span class="str">"PSDesiredStateConfiguration"</span><br />   <span class="typ">Node</span> <span class="str">'localhost'</span><span class="pun">{</span><br />     <span class="typ">File</span><span class="pln"> setupfiles </span><span class="pun">{</span><br />            <span class="typ">Type</span> <span class="pun">=</span> <span class="str">'Directory'</span><br />            <span class="typ">DestinationPath</span> <span class="pun">=</span><span class="pln"> $vdirectoryPath<br />            </span><span class="typ">Ensure</span> <span class="pun">=</span> <span class="str">"Present"</span><br />        <span class="pun">}</span><br />     <span class="pun">}</span><br />   <span class="pun">}</span><span class="pln"><br />setupfilezip</p><p></span><span class="typ">Start</span><span class="pun">-</span><span class="typ">DscConfiguration</span> <span class="pun">-</span><span class="typ">ComputerName</span><span class="pln"> localhost </span><span class="pun">-</span><span class="typ">Path</span><span class="pln"> setupfilezip </span><span class="pun">-</span><span class="typ">Wait</span> <span class="pun">-</span><span class="typ">Verbose</span></p><p><span class="pun">///</span><span class="pln">another powershell script</p><p></span><span class="typ">Invoke</span><span class="pun">-</span><span class="typ">Command</span> <span class="str">"C:\tmp\sample2.ps1"</span>

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

      It’ll be good if you can give us need more information,

      Which variable is getting null here ?
      What is the flow of execution ? (which script gets triggered first)

      • #181043
        Participant
        Topics: 1
        Replies: 1
        Points: -5
        Rank: Member

        its a single script

Viewing 1 reply thread
  • The topic ‘PowerShell DSC Variables Getting Null after Invoke-Command execute from pwrshell’ is closed to new replies.