0

I'm trying to pass some information from Test-TargetResource to Set-TargetResource using Global Variable but it doesn't work when I run my configuration .

Can you use Global Variables in DSC Resources ?

  • Welcome to SO. I think it would be better if you show use the code you are using so that the Community can better diagnose your issue. – Matt Apr 09 '15 at 12:40
  • I can show my code but that wont help in this case . I just found out that Set- and Test- are run at completely different cycles . So global Variable wont work in DSC Resource . – Mariusz Serwin Apr 09 '15 at 12:51
  • That is just my lack of knowledge then with DSC. Perhaps someone will chime in that has a better idea of how to pass data between cycles. Thanks. – Matt Apr 09 '15 at 12:56
  • Don Jones said that the best way is to create Private Function to do all work and then Set and Test can call it . Thanks for your comments . – Mariusz Serwin Apr 09 '15 at 13:53

1 Answers1

1

You cannot use global variables to do what you are attempting to do. A suggested approach is to call Test-TargetResource from Set-TargetResource.

Nana Lakshmanan
  • 741
  • 3
  • 6