Closed dronkoff closed 6 years ago
You might need to update WMF to 5.1 or later. What version is running on the 201R2 box?
Hi @dronkoff , unfortunately this resource is dependent on the *-ScheduledTask
powershell cmdlets. These were first introduced in Windows Server 2012 I think - so they don't exist in Windows Server 2008 R2. It is pretty unlikely that we'd be able to make this work with Windows Server 2008 R2 unfortunately.
@Hossman58 Pull server is 2012R2 and PS 5.1. Node is 2008R2 and PS 5.0. I didn't find official information about where ScheduledTasks module is included or how it can be installed on 2008R2, it would be great if you point me.
@PlagueHO Afaik, we can use schtasks.exe for automating scheduled tasks if ScheduledTasks module is missing. So it is possible. Module release page https://www.powershellgallery.com/packages/xComputerManagement/3.0.0.0 says that there do dependencies and a supported PS version is 4.0. I think it will be good either to support what's declared or declare what is really supported.
Hi @dronkoff - This module is supported on PS 4.0. However, the problem isn't in the version of PowerShell. The issue is that the ScheduledTasks
module, which this resource depends on, is not built into Windows Server 2008R2. It was first included in Windows Server 2012.
This is the case with many of the PowerShell modules: They are missing from older versions of Windows (Networking for example). In the odd occasion there is an easy work around. However in this case converting the resource over to use schtasks.exe
is not possible without a complete rewrite and would probably result in something really unstable and buggy (not to mention the problems that would arise with different localized versions of schtasks). I really can't see this happening unfortunately (unless someone else from the community has some ideas on how to do this).
But you are correct, this should be mentioned that Windows Server 2008R2 is not currently supported.
Hi! If the solution is not to fix this, then we should update documentation as well as dependencies. I shouldn't be able to install xComputerManagement on a box without ScheduledTasks module.
It is possible that some of the resources in this module do in fact work on Windows Server 2008 R2. So we'd need to confirm this before making a change like that to the manifest. But I'm not actually certain this is an approach the PowerShell DSC Team or the DSC community would recommend.
@kwirkykat are you able to offer some thoughts from the PSDSC team on this? If a resource module has a dependency on a module that may or may not be "built-in" to the OS, is it recommended practice to specify the dependent module in the resource manifest?
We've never done this in any of the resource kit resources that I know of and it seems like it might have some undesirable side-effects.
Module dependencies should address all dependencies of it's contents. If I write a script of two functions, one of them depend on some module, another is not. How do you think, does whole script depend on the module? Or if I write .Net assembly with two classes in it, one depends on another assembly, another is not. Does whole assembly depends on another one? I think both answers are yes. Usually such separation happens on assembly, script, module level. One function goes to the script without dependency and another function goes to the script with dependency. But two modules...
Now I have a successfully applied configuration on node that can not work.
PS C:\Windows\system32> Get-DscConfiguration
WARNING: [SKS06SP001]: [] The GET operation will be carried against a pending configuration
since the latest configuration has not converged yet.
Get-DscConfiguration : The term 'Get-ScheduledTask' is not recognized as the name of a cmdlet, function, script file, o
r operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ Get-DscConfiguration
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-ScheduledTask:root/Microsoft/...gurationManager) [Get-DscConfigurat
ion], CimException
+ FullyQualifiedErrorId : CommandNotFoundException,Get-DscConfiguration
Get-DscConfiguration : The PowerShell DSC resource '[xScheduledTask]Task_RestartSPtimer' with SourceInfo 'C:\DSCConfigs
\Ebz_TestConfig.ps1::39::9::xScheduledTask' threw one or more non-terminating errors while running the Get-TargetResour
ce functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this ch
annel for more details.
At line:1 char:1
+ Get-DscConfiguration
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (MSFT_DSCLocalConfigurationManager:root/Microsoft/...gurationManager)
[Get-DscConfiguration], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider,Get-DscConfiguration
Hi @dronkoff - I do understand the difficulty here. I have had a bit of a think about this. The trouble with blocking installation of a resource on a computer because it has an apply time dependency isn't a good idea here. Many people (including myself) develop & compile MOF files on machines that are not the target node (e.g. develop on a Desktop OS and apply on a Server OS). So preventing us from developing on machines that don't have the modules required on the target node is going to cause a problems for many people.
I do agree, that the apply time module dependencies of a resource should be made clear, I just don't think preventing the installation of the resource if the dependencies can not be met on the development machine is the right solution.
If there are no objections, I'd like to close this one because I don't think there is a good solution to this issue.
I don't think this issue should be closed without any resolution. If nobody is fixing it, it doesn't mean that it doesn't exist.
I'm happy to leave this open. But it is unlikely that I'll be able to add support to it for Windows Server 2008. But if someone else can contribute a solution then it would be gratefully accepted.
I don't see why this should be left open. There isn't going to be a fix for this as these modules will not be back ported to Windows 2008 R2. I don't believe even copying the modules from 2012 R2 to 2008 R2 will work as the modules are making API calls which simply don't exist in Windows 2008 R2.
The only answer is to update to a newer OS to get access to newer features.
I do agree though Microsoft could make it easier to say which operating systems a resource supports. That said I use xComputerManagement on 2008 R2 servers and make use of the xPowerPlan, xComputer and xVirtualMemory without issues.
To resolve this issue we have 2 options:
Last stable release was published 2 weeks ago but none of the above options were implemented there.
If someone were to make a submission for a Windows Server 2008 R2 compatible version using the COM interfaces it would be gladly accepted. But I don't think this is likely to happen, so in the meantime @dronkoff 's option 1 I think is the way to go (for now - could always change later if new options come to light).
So I'll submit a PR for this.
I've added the requirements information to the README.MD. I'll close this issue for now, but someone wants to have a crack at implementing this on Windows Server 2008 R2 then we should definitely reopen this.
I'm creating a DSC configuration with http pull server that will create certain scheduled tasks on both 2012R2 and 2008R2 servers. If target node is Windows Server 2008R2 the configuration cannot be applied.
Here are errors I see when run Update-DscConfiguration -Wait -Verbose