Invoke-DscResource - Should always be able to be run, no matter what RefreshMode is set to
Votes from Connect: 3
Original Date Submitted: 3/3/2015 7:34:33 AM
Description:
Contact Information
Handle: Rob Reynolds (FerventCoder)
Site Name: PowerShell
Feedback ID: 1157802
Frequency: Always Happens
Regression: No, this is new to the most recent version
Problem Description:
Why can Invoke-DscResource only be run when LCM.RefreshMode = 'Disabled'?
Disabled is not the default. This means I need to make system level changes just so I can run commands with this method. This severely limits the usefulness of the command.
I understand that you don't want competing resources, but that power should be handed over to the user to work with, not a constraint by the system. If there are competing resources happening, the user will ultimately notice the strain and will adjust.
Plus there is a possible use case where a user may want to use DSC by itself and 3rd party tools all at the same time.
Making system level changes just to run a 3rd party tool is very bad and if a 3rd party doesn't clean up, it could leave the system in a state where it is no longer able to run DSC configurations.
Was there a design decision that went into the RefreshMode setting / will this change in the future?
Product Studio item created by Connect Synchronizer due to creation of feedback ID 1157802 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=1157802).
Repro Steps:
$params = @{
Name = 'Environment'
Property = @{
Name = 'TestEnv';
Ensure = 'Present';
Path = $false;
Value = 'Test'
}
Verbose = $true
}
$result = Invoke-DscResource @params -Method Test
if (-not $result.InDesiredState) {
Invoke-DscResource -Method Set @params
}
Run that and you get:
VERBOSE: An LCM method call arrived from computer WIN2012R2X64 with user sid
S-1-5-[REMOVED]-500.
VERBOSE: Operation 'Invoke CimMethod' complete.
Invoke-DscResource : Invoke-DscResource cmdlet is not supported in PUSH mode.
Please set the LCM RefreshMode to DISABLED.
At C:\vagrant\powershelldsc\invoke-resource-tests.ps1:13 char:11
+ $result = Invoke-DscResource @params -Method Test
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (root/Microsoft/...gurationManag
er:String) [Invoke-DscResource], CimException
+ FullyQualifiedErrorId : MI RESULT 7,Microsoft.PowerShell.DesiredStateCon
figuration.Commands.InvokeDscResourceMethodCommand
Expected Results:
It should run the above no matter what RefreshMode is set to.
Internal BugId: 14280
