dsc

Using the File provider in DSC - Ensure Destination only contains files from Source

回眸只為那壹抹淺笑 提交于 2019-12-05 10:32:43
I've created a DSC resource to copy a Modules directory from a certain source. I'm testing it for a broader deployment in my environment. The resource does a great job ensuring all the files are there and that they match the source content, so far so good... The problem is this; I want to ensure that if there are any additional files in the target, or destination, a folder that they get removed. Here's my code: Configuration TestRun { Param ( $ComputerName = 'Localhost' ) Node $ComputerName { File LoadModules { Ensure = 'Present' Type = 'Directory' Force = $true Recurse = $true SourcePath = "C

How do you apply multiple DSC configurations?

爷,独闯天下 提交于 2019-12-05 06:37:04
Here's my example: $Config = @{ AllNodes = @( @{ NodeName = 'localhost'; PSDscAllowPlainTextPassword = $True } ) } Configuration LocalAdmin { Param([String[]]$Node='localhost',[PSCredential]$Cred) Import-DscResource -ModuleName 'PSDscResources' Node $Node { User 'LocalAdmin' { Username = 'Admin' Description = 'DSC configuration test' Ensure = 'Present' FullName = 'Administrator Extraordinaire' Password = $Cred PasswordChangeRequired = $False PasswordNeverExpires = $True } Group 'AddToAdmin' { GroupName = 'Administrators' DependsOn = '[User]LocalAdmin' Ensure = 'Present' MembersToInclude =

App Pool advanced settings using Powershell Desired Configuration State

时间秒杀一切 提交于 2019-12-04 03:04:34
How can I modify various settings inside either a new or exisitng App Pool using Powershell? I am interesting in some of the "Advanced" settings such as Enable 32-Bit Applications, Managed Pipeline Mode, Process Model Identity, etc. Any ideas on how I can do this? I tried using the xWebAdministration module but that seems to have very basic settings. Yes, a custom DSC resource is the only way to do this with DSC. If you are able to use PowerShell scripting without DSC, you can use the WebAdministration module module to create the pool, and then modify it from there. $appPoolName = "MyAppPool"

Chocolaty packages not installing via OneGet/PackageManagement in Windows 10?

别等时光非礼了梦想. 提交于 2019-12-03 23:43:08
I'm trying to use oneget w/chocolaty and it doesn't seem to be working at all. The package says it's installed, no warning or notification. It installs the package in the choco directory, but doesn't run the install script and therefore the application is not actually installed. Note this is Windows 10 (Powershell 5). Get-PackageProvider –Name Chocolatey -ForceBootstrap Set-PackageSource -Name chocolatey -Trusted Install-package filezilla -Verbose -Force -ProviderName chocolatey yields The answer - I wouldn't use the OneGet Chocolatey provider until you hear an official announcement that it is

Size vs Size On Disk

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I read about the byte vs cluster theory, but I don't think it can apply in my case; Doesn't seem to have to do with "a bunch of small files"; . ├―― [ 11K ] 2ndVisit _Checklist . xlsx ├―― [ 35K ] 2ndVisit FTS_Timetable . xlsx ├―― [ 34K ] 2ndVisit _Roomlist . pdf ├―― [ 27K ] 2ndVisit _Teilnehmer . xlsx ├―― [ 9.5K ] Belgian Pupils for European Parliament . xlsx ├―― [ 4.0K ] Brussel EU │ ├―― [ 64K ] Checkliste . doc │ ├―― [ 144K ] Plan A73 . doc │ ├―― [ 38K ] TN Liste EP . docx │ └―― [ 108K ] TN Liste EP V02 . doc ├―― [ 12K ] Financial

11.PowerShell DSC之安装PowerShell Module

匿名 (未验证) 提交于 2019-12-03 00:13:02
打开https://powershellgallery.com,检索你需要的目标模块,我们以安装名为“xmysql”的module为例: 1.执行命令install-module -name xmysql 1.x.可能会提示权限不足,那就使用管理员打开PowerShell 可能会提示nuget-anycpu-2.8.5.127.exe找不到,无法下载,可以到这里下载 https://oneget.org/nuget-anycpu-2.8.5.127.exe ,然后放在“C:\Program Files\PackageManagement\ProviderAssemblies”文件夹下。 (解决方案见: https://github.com/OneGet/oneget/issues/153 ) 2.正确的情况下,会稍等几秒钟就执行完毕,在C:\Program Files\WindowsPowerShell\Modules下查看下载的module 通过Get-Module -ListAvailable命令可以验证 1.在powershellgallery下载对应的nupkg文件,下载后,重命名为.zip格式,解压,调整为module所需的文件夹结构,复制到C:\Program Files\WindowsPowerShell\Modules下 2.通过Get-Module

How do you automatically distribute Desired State Configuration custom resources as part of a deployment?

主宰稳场 提交于 2019-12-01 16:52:00
I'm working on leveraging Microsoft's DSC Resource Kit (specifically, XWebAdministration, at least for starters). I'm relatively familiar with DSC, so no worries on the script's actual functionality... it does what it's supposed to, or at least I'm pretty sure it does. The problem is that when I execute the script from my orchestration box, the servers I'm targeting return this error: The PowerShell provider xWebAdministration does not exist at the PowerShell module path nor is it registered as a WMI provider. + CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager :String) [],

PowerShell: How to install the DSC Resource Kit Wave 8 modules?

早过忘川 提交于 2019-12-01 08:46:56
I am trying to set up a DSC pull server on Windows 2012 R2 machine by following this technet article: http://technet.microsoft.com/en-us/library/dn249913.aspx However I just can't get the modules working. The installation instructions says: To install all DSC Resource Kit Modules, unzip the content under $env:ProgramFiles\WindowsPowerShell\Modules To confirm installation run Get-DSCResource to see that all of the resources on this page are among the DSC Resources listed. So I copied the content of the 'DSC Resource Kit Wave 8 10282014' folder to C:\Program Files\WindowsPowerShell\Modules which

7.PowerShell DSC之模式

对着背影说爱祢 提交于 2019-11-30 12:31:58
DSC两种模式 DSC有两种模式,Push模式和Pull模式 Push模式 基本流程 写配置--编译生成mof--推送到目标服务器,由目标服务器LCM执行mof并进行指定的配置 优点 架构简单。成本低,任意一台电脑都可以编写配置文件,适合学习、测试、UAT环境等 缺点 目标节点不一定就绪,可能Push不成功 Pull模式 基本流程 配置Pull Sercer 配置各个目标服务器 写配置和发布配置到Pull Server,等待各个节点定时拉取(拉取内容包括mof文件和资源文件) 优点 不用管各个节点的就绪情况,就绪好了会主动拉取 缺点 需要一台服务器充当Pull Server 参考 https://www.red-gate.com/simple-talk/sysadmin/powershell/powershell-desired-state-configuration-the-basics/ 来源: https://www.cnblogs.com/talentzemin/p/11587452.html

How do I resolve “Cannot invoke the SendConfigurationApply method.” when performing Start-DscConfiguration?

风格不统一 提交于 2019-11-30 12:19:37
Another way to phrase the question less specifically: What is the correct way to 'reset' the DSC processes on a target machine? I've created a DSC configuration that I'm iterating on right now, and I am adding new Package configuration which I've gotten wrong. I determined that by forgetting to supply the /quiet argument to an MSI installer in a Package block I can cause the Start-DscConfiguration cmdlet to 'hang'. At the onset of this 'hang' I stop the DSC configuration operation on my local machine and attempt to correct the configuration problem (by adding the /quiet argument in my example)