The articles all discuss staging, packaging and a bunch of infrastructure aspects.
Is it possible to just run the scripts, either locally, or (preferable!) against a remote server?
E.g. infrastructure-free, like I can run ssh commands now?
The articles all discuss staging, packaging and a bunch of infrastructure aspects.
Is it possible to just run the scripts, either locally, or (preferable!) against a remote server?
E.g. infrastructure-free, like I can run ssh commands now?
Yes, what you're looking for is "Push" mode. Instead of setting up a pull server and using a GUID to name the files, you just run
Start-DscConfiguration
against the local machine or a remote machine.You still need Windows Management Framework 4 installed and the target node must allow incoming WinRM connections, even if the target is the local node.
This is not exactly comparable to using SSH though, because once you apply the configuration it will be reapplied automatically. When you install the
Windows PowerShell Desired State Configuration Service
Feature, it automatically sets up the LCM in Pull mode. To see that, runGet-DscLocalConfigurationManager
. You'll also see the settings for how often the configuration is checked for changes (30 minutes by default) and how often the current configuration is re-applied (15 minutes by default). Once you've actually pushed a config, a scheduled task called Consistency will show up underTask Scheduler Library\Microsoft\Windows\Desired State Configuration
which actually does the work here.I also want to clarify that you don't directly apply the configuration scripts that you write in Powershell. Whether you push or pull the configs, you still have to execute the script first to "compile" it into an MOF file, and that's the file that gets applied.
A better analogue to SSH is Powershell remoting, which allows you to run code against a remote machine or use an interactive prompt in a remote machine. That requires Powershell remoting to be enabled on the target machine. For that you would use
Enter-PSSession
for an interactive prompt, or useInvoke-Command
to run a script block on the remote machine(s).