Im starting by talking about my current Powershell script(s) - but this will turn out to be a more a C# issue...
I have 3 Powershell scripts that all work as expected. The first one includes a GUI that allows the user to select a variety of functions. Once the functions are selected, it runs through each one sequentially. However there are a couple that require a restart of the local machine. Such as Renaming the PC & Joining a Domain.
The 'restarting' portion is not too troublesome, as - when appropriate - the script sets a RunOnce registry key, which in turn calls the 2nd script after the reboot is complete. If necessary (depending on the original options selected), it sets another RunOnce key to call the 3rd script after another reboot.
My problem thus far is how to save variables/states for Post-reboot processes.
Say the user selects 5 options...
-Rename the machine -Join Domain -Disable Hibernation -Configure WSUS -Reset Indexing
My 3rd script contains functions for those last 3 items + others. I want that 3rd script to "know" which options/functions were originally selected and to only run those - not the others that have NOT been selected.
Now i started writing this in PS, because most of my tasks are System Configuration and i felt like PS was the more appropriate language for this. However, i cant find a way to complete this the way i want. I have 'limited' experience in C# - enough to do all of the functions i want - Or to at least use C# as a wrapper that calls PS scripts. But im unsure of how i can save the state of the selected items that can get called on any subsequent reboots.
Appreciate any responses.
Thanks! Mike