Skip to content

Instantly share code, notes, and snippets.

@itpropro
Created February 22, 2016 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itpropro/11c0ebbb678895131375 to your computer and use it in GitHub Desktop.
Save itpropro/11c0ebbb678895131375 to your computer and use it in GitHub Desktop.
#Does not work with DSC Configurations, using the $using: variable to change scopes
Invoke-Command -ScriptBlock (Get-Command .\DSCConfig.ps1|select -ExpandProperty ScriptBlock) -ComputerName localhost
Invoke-Command -FilePath ('.\' + $DSCConfig + '.ps1') -ComputerName localhost
#Does work with $using because of the -NoNewScope switch
Invoke-Command -ScriptBlock (Get-Command .\DSCConfig.ps1|select -ExpandProperty ScriptBlock) -NoNewScope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment