前言

LCM的默认mode就是push,所以对于push模式,我们直接就三步走

以下是示例:

1.编写配置 Authoring

Configuration WebsiteTest {

    # Import the module that contains the resources we're using.
Import-DscResource -ModuleName PsDesiredStateConfiguration # The Node statement specifies which targets this configuration will be applied to.
Node 'TargetComputerName' { # The first resource block ensures that the Web-Server (IIS) feature is enabled.
WindowsFeature WebServer {
Ensure = "Present"
Name = "Web-Server"
} # The second resource block ensures that the website content copied to the website root folder.
File WebsiteContent {
Ensure = 'Present'
SourcePath = 'c:\test\index.htm'
DestinationPath = 'c:\inetpub\wwwroot'
}
}
}

2.编译配置 Staging

. .\WebsiteTest.ps1
WebsiteTest

3.应用配置 Execution

Start-DscConfiguration .\WebsiteTest

参考

https://www.red-gate.com/simple-talk/sysadmin/powershell/powershell-desired-state-configuration-lcm-and-push-management-model/

https://docs.microsoft.com/en-us/powershell/dsc/quickstarts/website-quickstart

8.PowerShell DSC之Push的更多相关文章

  1. 6.PowerShell DSC核心概念之LCM

    什么是LCM? 本地配置管理器 (LCM) 是DSC的引擎. LCM 在每个目标节点上运行,负责分析和执行发送到节点的配置. 它还负责 DSC 的许多方面,包括以下各方面. 确定刷新模式(推送或请求) ...

  2. 10.PowerShell DSC之细节

    mof文件到各Node放在哪里了? 在C:\Windows\System32\Configurtion文件夹下: 你可能会注意到mof的文件名称和Pull Server上的不一致,并且多出了几个.不用 ...

  3. 9.PowerShell DSC之Pull

    前言 一般生产环境都使用Pull模式 配置Pull Server 配置Pull Server需要安装两个WindowsFeture:IIS.windows DSC,这两都可以通过UI界面化引导安装,也 ...

  4. 5.PowerShell DSC核心概念之资源

    什么是资源? 资源为 DSC 配置提供构建基块. 资源公开可配置的属性,并包含本地配置管理器 (LCM) 调用以"使其如此"的 PowerShell 脚本函数. 系统内置资源 可在 ...

  5. 4.PowerShell DSC核心概念之配置

    什么是配置 DSC 配置是定义某一特殊类型函数的 PowerShell 脚本. 配置的语法 Configuration MyDscConfiguration { #配置块 Import-DscReso ...

  6. 3.PowerShell DSC核心概念

    PowerShell DSC有三个核心概念 配置 配置是声明性的PowerShell 脚本,用于定义和配置资源实例. DSC 配置是幂等的. 资源 资源是 DSC 的"实现器"部分 ...

  7. 1.PowerShell DSC概述

    什么是PowerShell DSC DSC 是一个声明性平台,用于配置.部署和管理系统. PowerShell PowerShell 是构建于 .NET 上基于任务的命令行 shell 和脚本语言. ...

  8. PowerShell DSC学习资料

    官网 https://docs.microsoft.com/zh-cn/powershell/dsc/overview/overview CSDN中文博客(专题,32篇) https://blog.c ...

  9. 7.PowerShell DSC之模式

    DSC两种模式 DSC有两种模式,Push模式和Pull模式 Push模式 基本流程 写配置--编译生成mof--推送到目标服务器,由目标服务器LCM执行mof并进行指定的配置 优点 架构简单.成本低 ...

随机推荐

  1. 解决Tengine健康检查引起的TIME_WAIT堆积问题

    简介: 解决Tengine健康检查引起的TIME_WAIT堆积问题 一. 问题背景 "服务上云后,我们的TCP端口基本上都处于TIME_WAIT的状态"."这个问题在线下 ...

  2. xtrabackup迁移mysql5.7.32

    问题描述:利用外部xtrabackup工具来做迁移mysql数据库,或者恢复数据库 xtrabackup迁移mysql 1.环境 mysql源库 mysql目标迁移库 IP 192.168.163.3 ...

  3. zabbix_server上的问题

    不要写成127.0.0.1,要不然一直包zabbix agent没有启动.

  4. 【Oracle】DRM官方介绍

    DRM 简介 By:  Allen Gao 首先,我们对和DRM 相关的一些概念进行介绍. Buffer: 对于RAC 数据库,当一个数据块被读入到buffer cache后,我们就称其为buffer ...

  5. VS2019项目docker启动且访问SQLSERVER数据库配置

    VS2019编译.调试的Blazor纯前台项目,使用控制台启动,去连接纯后台的API项目,使用docker启动,并且通过EFCore访问SQLSERVER数据库,有几个地方需要修改配置: 一.前台连后 ...

  6. ping 命令示例

    将下面的代码粘贴到记事本中,然后保存为扩展名为BAT的文件,运行就可以将网段内ping不通的IP地址写入到文本文件IP.txt中. @echo offsetlocal ENABLEDELAYEDEXP ...

  7. Vue中:error 'XXXXX' is not defined no-undef解决办法

    Vue中:error 'XXXXX' is not defined no-undef解决办法 报错内容: × Client Compiled with some errors in 7.42s √ S ...

  8. Linux 通过端口终止进程

    以下命令可用于杀死占用某端口的所有进程. root 用户: kill -9 $(lsof -i tcp:进程号 -t) 非 root 用户: kill -9 $(sudo lsof -i tcp:进程 ...

  9. http的响应码及含义

    1xx(临时响应) 100: 请求者应当继续提出请求. 101(切换协议) 请求者已要求服务器切换协议,服务器已确认并准备进行切换. 2xx(成功) 200:正确的请求返回正确的结果 201:表示资源 ...

  10. oracle 常用语法()

    一ORACLE的启动和关闭 1在单机环境下 2在双机环境下 Oracle数据库有哪几种启动方式 1startup nomount 2startup mount dbname 3startup open ...