counsyl / puppet-windows Goto Github PK
View Code? Open in Web Editor NEWPuppet configurations for common Windows administration
License: Other
Puppet configurations for common Windows administration
License: Other
code/modules/windows/manifests/update.pp
View file @ 58717d1a
... ...
@@ -84,7 +84,7 @@ class windows::update(
validate_bool($all_users)
validate_re($type, '^[2-5]$')
validate_re($day, '^[0-7]$')
- validate_re($time, '^[0-23]$')
+ validate_re($time, '^(\d|1\d|2[0-4])(\.\d{1,2})?$')
validate_bool($reboot_required)
The regex is not working like that - [] is for single characters (...ranges).
Modifying the paths in /etc/puppetlabs/code/environments/production/modules/windows/manifests/java.pp
seems to have no effect.
if $version == '7' {
$home = 'D:\Program Files\Java\jre7'
} else {
}
I have a legacy piece of software that I am supporting that needs to register some OCX controls and DLL files. When using the windows::regsvr32 class some of my controls are registered on every puppet agent run.
I have had a bit of a look at the code and can see the powershell that is being used in the erb template for finding the CLSID entries in the registry. It would seem what is defined there isn't broad enough to find some controls that are registered with the regsrvr32 utility as it would seem that it isn't always consistent on where it puts it.
In my searching through the registry I found the CLSID in different spots for different controls.
msvbvm50.dll -- runs every time
HKLM\Software\Classes\TypeLib\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKLM\Software\Classes\Wow6432Node\Interface\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKLM\Software\Classes\Wow6432Node\TypeLib\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKLM\Software\Wow6432Node\Classes\TypeLib\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
TeeChart.ocx -- only runs the first time -- unless statement correctly detects it
HKCR\Wow6432Node\CLSID\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKLM\Software\Classes\Wow6432Node\CLSID\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKLM\Software\Wow6432Node\Classes\CLSID\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
TSGACAL.OCX -- runs every time
HKCR\TypeLib\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKCR\Wow6432Node\CLSID\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKCR\Wow6432Node\TypeLib\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKLM\Software\Classes\TypeLib\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKLM\Software\Classes\Wow6432Node\TypeLib\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKLM\Software\Wow5432Node\Classes\TypeLib\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
COMCTL32 -- only runs the first time -- unless statement correctly detects it
HKCR\Wow6432Node\CLSID\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKLM\Software\Classes\Wow6432Node\CLSID\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
HKLM\Software\Wow6432Node\Classes\CLSID\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
The only common element in those is:
HKLM:\SOFTWARE\Classes\*
So I have tested a bit of powershell that searches the registry for the CLSID from that path and returns exit 1
if it doesn't find a match and it works ok but of course takes a bit longer than a direct Test-Path.
I'm happy to make a pull request if you like to edit the erb template to run my updated powershell that does a broader search but thought I would raise this issue here first as it would have some performance impact.
With the following code:
windows::unzip { "foo":
zipfile => "Z:\\path\which\doesnotexist.zip"
}
The unzip resource happily returns with no error.
The unzip.ps1 template should propagate any errors though the return code which would cause puppet resource to fail.
When I try to install the module, I get the following error:
Error: Could not install module 'counsyl-windows' (???)
No version of 'counsyl-windows' can satisfy all dependencies
Use puppet module install --ignore-dependencies
to install only this module
thank you,
Levent
Puppet Forge reports 1.0.4 has been released, but there is no tag for it in the repo.
The java class is unable to download Java 8u121, due to new measures put in place at Oracle. The puppetlabs-java folks have a PR puppetlabs/puppetlabs-java#214 that might be useful.
Hi,
Looking into the code for this function, it would suggest that the password for the user is written into the registry in plain text.
Which would mean that anyone with access to this registry key would have the password.
The AutoLogon application by SysInternals does not do this, could a similar approach be used? where the password is encrypted?
The class windows::shortcut is not usable for all kind of URLs because function validate_absolute_path fails when target is a web link (i. e. "http://www.google.de") or a network share (i. e. "\my\shared\folder") or a mail link (i. e. "mailto://[email protected]").
To honor the common possibility in Windows to create shortcuts with more kinds of URLs than just file links I plead to skip the absolute path validation of the target parameter.
Im trying to use this module with puppet5 and puppetlabs-registry has been updated to version 2.0.1 and better puppet5 support. But puppetlibrarian doesnt like the upper limit of 2.0 version in this module.
Whilst trying to remove a newly created test shortcut I noticed ensure => absent
is not supported.
Thanks for adding that feature.
The shortcut recipe keeps running.
shortcut { "C:/users/public/desktop/${hv}.lnk":
target => "C:/Program Files/${hv}/lpclientpc.bat",
icon_location => "C:/Program Files/${hv}/lpclientpc.ico",
working_directory => "C:/Program Files/${hv}/",
}
Notice: /Stage[main]/Hv::Windows/Shortcut[C:/users/public/desktop/HVClient-Nov2018.lnk]/Exec[ensure shortcut C:/users/public/desktop/HVClient-Nov2018.lnk]/returns: executed successfully
Using Puppet 3.8.7 on windows and with future parsing enabled and manifest ordering. If I have a simple class like this;
#===Software Artifact Unzip========
file { "$tempfolder":
ensure => 'directory',
} ->
file { "$tempfolder\\software.zip":
ensure => 'present',
source_permissions => ignore,
source => "$fullInstallerLocation",
} ->
windows::unzip { "$tempfolder\\software.zip":
destination => "$tempfolder",
creates => "$tempfolder\\myfile.txt",
require => File["$tempfolder\\software.zip"],
}
Results in this execution order;
So, 1 -> 3 -> 2 instead of 1 -> 2 -> 3. I even put a requires in but it doesn't seem to help.
Any ideas?
Thanks!
Iain
It seems that screen_saver will only work for admin users. When trying to use it for non-admin users it fails to find the registry path:
PS C:\Windows\system32> Set-ItemProperty -Path $regpath -Name "ScreenSaveActive" -Value 1 -Force;
Set-ItemProperty : Der Pfad "HKEY_USERS\S-1-5-21-224108373-3687871180-31578548-1003\Control Panel\Desktop" kann nicht gefunden werden, da er nicht vorhanden ist.
In Zeile:1 Zeichen:1
+ Set-ItemProperty -Path $regpath -Name "ScreenSaveActive" -Value 1 -Fo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKEY_USERS\S-1-...l Panel\Desktop:String) [Set-ItemProperty], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand
(I've ran the powershell command manually for debug purposes.)
When searching the registry for this path I can confirm that it cannot be found.
Tested on Windows 10 Pro.
Any ideas?
Why has this module not been submitted to puppet forge? There are a bunch of useful items in here I'd like to be able to automagically take advantage of.
It's also possible that the forge's horrible search just makes it impossible to find.
link is broken to windows::update is broken
Windows 8 and 2012 have changed the way that the windows update service works, and a new feature called Trigger Start makes the service to be stopped for inactivity.
The issue is that the windows::update class is always trying to start the service.
Reference: https://tickets.puppetlabs.com/browse/MODULES-2420
The dependencies on this module explicitly require puppetlabs-powershell < 2.0.0
. Allowing later versions would be convenient for avoiding dependency conflicts.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.