[27] Window PowerShell DSC 学习系列----DSC 5.x 查询节点注册和执行报告(Report)查询

原创 2017年04月18日 14:22:57

我们知道,一旦我们把DSCD额Pull服务器安装成功,且目标节点也注册成功后,我们就可以调用DSC服务的oData的查询。去查询一些信息。


@查询节点的注册信息

如果已知AgentID,可以查询节点相关的注册信息。比如下面能查到当前的目标节点的相关信息,比如,计算机名字,IP地址,注册的ConfigurationName的名字是。

请注意,浏览器可能不支持oData的Http的get操作。因此笔者借助了第三方的HTTP的发送工具,比如,Advanced REST Client,注意请在HTTP的头里面加入:

Protocolversion: 2.0
accept: application/json;odata=minimalmetadata;streaming=true;charset=utf-8


例子:

http://test-dsc-server:8082/PSDSCPullServer.svc/Nodes(AgentId='304DC9EE-12D4-11E7-80B8-B9D2EE16DFC9')

返回结果:

{
"AgentId": "304DC9EE-12D4-11E7-80B8-B9D2EE16DFC9"
"AgentInformation": 
{
"LCMVersion": "2.0"
"NodeName": "TEST-DSC-CLIENT"
"IPAddress": "192.168.1.89;127.0.0.1;fe80::787f:37f6:2981:2e05%12;::2000:0:0:0;::1;::2000:0:0:0;2001:0:9d38:6ab8:3c85:2910:3f57:fea6;fe80::3c85:2910:3f57:fea6%14"
}
"ConfigurationNames": 
  "unzipFile"
"RegistrationInformation": 
{
"RegistrationMessageType": null
"CertificateInformation": null
}
"AdditionalData": 
}

@查询节点的执行结果信息

如果已知AgentID,可以查询节点相关的执行结果。

例子:

在浏览器里面打开:

http://test-DSC-SERVER:8082/PSDSCPullServer.svc/Nodes(AgentId='304DC9EE-12D4-11E7-80B8-B9D2EE16DFC9')/Reports


返回结果:

<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="http://test-dsc-server:8082/PSDSCPullServer.svc/"
	xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
	xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
	xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
	<id>http://test-dsc-server:8082/PSDSCPullServer.svc/Nodes(AgentId='304DC9EE-12D4-11E7-80B8-B9D2EE16DFC9')/Reports
	</id>
	<title type="text">Reports</title>
	<updated>2017-04-17T07:19:04Z</updated>
	<link rel="self" title="Reports" href="Reports" />
	<entry>
		<id>http://test-dsc-server:8082/PSDSCPullServer.svc/Reports('e7a0061d-233d-11e7-80b9-c7047977fc22')
		</id>
		<category term="MSFT.DSCReport"
			scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
		<link rel="edit" title="DSCReport"
			href="Reports('e7a0061d-233d-11e7-80b9-c7047977fc22')" />
		<link
			rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Nodes"
			type="application/atom+xml;type=entry" title="Nodes"
			href="Reports('e7a0061d-233d-11e7-80b9-c7047977fc22')/Nodes" />
		<title />
		<updated>2017-04-17T07:19:04Z</updated>
		<author>
			<name />
		</author>
		<content type="application/xml">
			<m:properties>
				<d:JobId>e7a0061d-233d-11e7-80b9-c7047977fc22</d:JobId>
				<d:OperationType>LocalConfigurationManager</d:OperationType>
				<d:RefreshMode>Pull</d:RefreshMode>
				<d:Status>Success</d:Status>
				<d:ReportFormatVersion>2.0</d:ReportFormatVersion>
				<d:ConfigurationVersion>2.0.0</d:ConfigurationVersion>
				<d:StartTime m:type="Edm.DateTime">2017-04-17T07:17:50</d:StartTime>
				<d:EndTime m:type="Edm.DateTime">2017-04-17T07:18:11</d:EndTime>
				<d:RebootRequested>False</d:RebootRequested>
				<d:Errors m:type="Collection(Edm.String)" />
				<d:StatusData m:type="Collection(Edm.String)">
					<d:element>{"StartDate":"2017-04-17T07:17:50.7050000+00:00","IPV6Addresses":["fe80::787f:37f6:2981:2e05%12","::2000:0:0:0","::1","::2000:0:0:0","2001:0:9d38:6ab8:3c85:2910:3f57:fea6","fe80::3c85:2910:3f57:fea6%14"],"DurationInSeconds":"21","JobID":"{E7A0061D-233D-11E7-80B9-C7047977FC22}","CurrentChecksum":"63606109E45835E2F508D95CB00A61203549AD96E6EABF2BC647230DA6357A0F","MetaData":"Author:
						Administrator; Name: PullClientConfigNames; Version: 2.0.0;
						GenerationDate: 04/17/2017 07:17:24; GenerationHost:
						test-DSC-CLIENT;","Status":"Success","IPV4Addresses":["192.168.1.89","127.0.0.1"],"LCMVersion":"2.0","NumberOfResources":"0","Type":"LocalConfigurationManager","HostName":"test-DSC-CLIENT","RebootRequested":"False","MACAddresses":["FA-16-3E-7B-59-B6","00-00-00-00-00-00-00-E0","00-00-00-00-00-00-00-E0"],"MetaConfiguration":{"AgentId":"304DC9EE-12D4-11E7-80B8-B9D2EE16DFC9","ConfigurationDownloadManagers":[{"SourceInfo":"C:\\dsc\\registerto2.55AccessSQLServer.ps1::18::9::ConfigurationRepositoryWeb","AllowUnsecureConnection":"True","ServerURL":"http://test-DSC-SERVER:8082/PSDSCPullServer.svc","RegistrationKey":"","ResourceId":"[ConfigurationRepositoryWeb]pull51w2k12nssl","ConfigurationNames":["unzipFile"]}],"ActionAfterReboot":"ContinueConfiguration","LCMCompatibleVersions":["1.0","2.0"],"LCMState":"Idle","ResourceModuleManagers":[],"ReportManagers":[{"AllowUnsecureConnection":"True","RegistrationKey":"","ServerURL":"http://test-DSC-SERVER:8082/PSDSCPullServer.svc","ResourceId":"[ReportServerWeb]pull51w2k12nssl","SourceInfo":"C:\\dsc\\registerto2.55AccessSQLServer.ps1::28::9::ReportServerWeb"}],"StatusRetentionTimeInDays":"10","LCMVersion":"2.0","MaximumDownloadSizeMB":"500","ConfigurationMode":"ApplyAndAutoCorrect","RefreshFrequencyMins":"30","RebootNodeIfNeeded":"True","SignatureValidationPolicy":"NONE","RefreshMode":"Pull","DebugMode":["ForceModuleImport"],"LCMStateDetail":"","AllowModuleOverwrite":"False","ConfigurationModeFrequencyMins":"15","SignatureValidations":[]},"Locale":"en-US","Mode":"Pull"}
					</d:element>
				</d:StatusData>
				<d:AdditionalData m:type="Collection(MSFT.PropertyBag)">
					<d:element>
						<d:Key>OSVersion</d:Key>
						<d:Value>{"VersionString":"Microsoft Windows NT
							6.3.9600.0","ServicePack":"","Platform":"Win32NT"}</d:Value>
					</d:element>
					<d:element>
						<d:Key>PSVersion</d:Key>
						<d:Value>{"CLRVersion":"4.0.30319.42000","PSVersion":"5.1.14409.1005","BuildVersion":"10.0.14409.1005"}
						</d:Value>
					</d:element>
				</d:AdditionalData>
			</m:properties>
		</content>
	</entry>
	<entry>
		<id>http://test-dsc-server:8082/PSDSCPullServer.svc/Reports('03c765d9-233e-11e7-80b9-c7047977fc22')
		</id>
		<category term="MSFT.DSCReport"
			scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
		<link rel="edit" title="DSCReport"
			href="Reports('03c765d9-233e-11e7-80b9-c7047977fc22')" />
		<link
			rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Nodes"
			type="application/atom+xml;type=entry" title="Nodes"
			href="Reports('03c765d9-233e-11e7-80b9-c7047977fc22')/Nodes" />
		<title />
		<updated>2017-04-17T07:19:04Z</updated>
		<author>
			<name />
		</author>
		<content type="application/xml">
			<m:properties>
				<d:JobId>03c765d9-233e-11e7-80b9-c7047977fc22</d:JobId>
				<d:OperationType>Initial</d:OperationType>
				<d:RefreshMode>Pull</d:RefreshMode>
				<d:Status>Success</d:Status>
				<d:ReportFormatVersion>2.0</d:ReportFormatVersion>
				<d:ConfigurationVersion>2.0.0</d:ConfigurationVersion>
				<d:StartTime m:type="Edm.DateTime">2017-04-17T07:18:12</d:StartTime>
				<d:EndTime m:type="Edm.DateTime">2017-04-17T07:18:14</d:EndTime>
				<d:RebootRequested>False</d:RebootRequested>
				<d:Errors m:type="Collection(Edm.String)" />
				<d:StatusData m:type="Collection(Edm.String)">
					<d:element>{"StartDate":"2017-04-17T07:18:12.6580000+00:00","IPV6Addresses":["fe80::787f:37f6:2981:2e05%12","::2000:0:0:0","::1","::2000:0:0:0","2001:0:9d38:6ab8:3c85:2910:3f57:fea6","fe80::3c85:2910:3f57:fea6%14"],"DurationInSeconds":"2","JobID":"{03C765D9-233E-11E7-80B9-C7047977FC22}","CurrentChecksum":"701051B61256AC25CBEAE0A83AF5F06CD626D6F26CD23F03ECD5C2D524194479","MetaData":"Author:
						Administrator; Name: testzip; Version: 2.0.0; GenerationDate:
						04/17/2017 07:16:38; GenerationHost:
						test-DSC-SERVER;","RebootRequested":"False","Status":"Success","IPV4Addresses":["192.168.1.89","127.0.0.1"],"LCMVersion":"2.0","NumberOfResources":"1","Type":"Initial","HostName":"test-DSC-CLIENT","ResourcesInDesiredState":[{"SourceInfo":"C:\\Program
						Files\\WindowsPowerShell\\Modules\\xPSDesiredStateConfiguration\\5.1.0.0\\DSCResources\\MSFT_xDSCWebService\\pubmof.ps1::5::7::Archive","ModuleName":"PSDesiredStateConfiguration","DurationInSeconds":"1.219","InstanceName":"ArchiveExample","StartDate":"2017-04-17T07:18:13.9080000+00:00","ResourceName":"Archive","ModuleVersion":"1.1","RebootRequested":"False","ResourceId":"[Archive]ArchiveExample","ConfigurationName":"testzip","InDesiredState":"True"}],"MACAddresses":["FA-16-3E-7B-59-B6","00-00-00-00-00-00-00-E0","00-00-00-00-00-00-00-E0"],"MetaConfiguration":{"AgentId":"304DC9EE-12D4-11E7-80B8-B9D2EE16DFC9","ConfigurationDownloadManagers":[{"SourceInfo":"C:\\dsc\\registerto2.55AccessSQLServer.ps1::18::9::ConfigurationRepositoryWeb","AllowUnsecureConnection":"True","ServerURL":"http://test-DSC-SERVER:8082/PSDSCPullServer.svc","RegistrationKey":"","ResourceId":"[ConfigurationRepositoryWeb]pull51w2k12nssl","ConfigurationNames":["unzipFile"]}],"ActionAfterReboot":"ContinueConfiguration","LCMCompatibleVersions":["1.0","2.0"],"LCMState":"Idle","ResourceModuleManagers":[],"ReportManagers":[{"AllowUnsecureConnection":"True","RegistrationKey":"","ServerURL":"http://test-DSC-SERVER:8082/PSDSCPullServer.svc","ResourceId":"[ReportServerWeb]pull51w2k12nssl","SourceInfo":"C:\\dsc\\registerto2.55AccessSQLServer.ps1::28::9::ReportServerWeb"}],"StatusRetentionTimeInDays":"10","LCMVersion":"2.0","MaximumDownloadSizeMB":"500","ConfigurationMode":"ApplyAndAutoCorrect","RefreshFrequencyMins":"30","RebootNodeIfNeeded":"True","SignatureValidationPolicy":"NONE","RefreshMode":"Pull","DebugMode":["ForceModuleImport"],"LCMStateDetail":"","AllowModuleOverwrite":"False","ConfigurationModeFrequencyMins":"15","SignatureValidations":[]},"Locale":"en-US","Mode":"Pull"}
					</d:element>
				</d:StatusData>
				<d:AdditionalData m:type="Collection(MSFT.PropertyBag)">
					<d:element>
						<d:Key>OSVersion</d:Key>
						<d:Value>{"VersionString":"Microsoft Windows NT
							6.3.9600.0","ServicePack":"","Platform":"Win32NT"}</d:Value>
					</d:element>
					<d:element>
						<d:Key>PSVersion</d:Key>
						<d:Value>{"CLRVersion":"4.0.30319.42000","PSVersion":"5.1.14409.1005","BuildVersion":"10.0.14409.1005"}
						</d:Value>
					</d:element>
				</d:AdditionalData>
			</m:properties>
		</content>
	</entry>
</feed>
版权声明:本文为博主原创文章,未经博主允许不得转载。

[22]Window PowerShell DSC学习系列---- 如何用PowerShell脚本查看DSC服务器的执行报表(Report)

本文只适合DSC 5.x的版本。我们知道在DSC 5.x的版本中,Pull服务器和Report是安装在一起的。那么当目标节点注册成功到Pull和Report服务器之后,且Pull服务器上的MOF和Re...
  • chancein007
  • chancein007
  • 2017年02月14日 13:45
  • 1705

[1] Window PowerShell DSC 学习系列----DSC的定义和2种架构模式

PowerShell DSC是PowerShell的一部分,是一个新的管理平台,英文全称为,PowerShell Desired Status Configuration,翻译成中文就是理想管理配置状...
  • chancein007
  • chancein007
  • 2017年01月09日 23:09
  • 1566

[5] Window PowerShell DSC 学习系列----如何生成一个DSC MOF文件?

在前面的四个章节,笔者介绍了一些PowerShell基础的知识,包括PowerShell DSC的基本架构,DSC的资源以及配置格式,已经在PowerShell DSC 如何安装扩展的DSC Modu...
  • chancein007
  • chancein007
  • 2017年01月23日 16:07
  • 1439

[7] Window PowerShell DSC 学习系列----如何被管理的设置节点注册到Pull Server?

在上一节,[6] Window PowerShell DSC 学习系列----如何安装最新的PowerShell DSC 5.1 Pull Server?笔者聊到了如何安装Pull Server。那么...
  • chancein007
  • chancein007
  • 2017年01月24日 16:01
  • 1349

[10] Window PowerShell DSC 学习系列----目标节点和Pull 服务器底层通信原理剖析

在本节中,笔者将会用wireshark抓包,并分析目标节点如何和Pull 服务器通信的?注意笔者本机装的Window Management Framework 5.1,如果是其他的版本,可能请求的UR...
  • chancein007
  • chancein007
  • 2017年01月25日 13:45
  • 2021

[24]Window PowerShell DSC学习系列---- 如何保护MOF文件里面存储的密码?

在上节笔者分享了[23]Window PowerShell DSC学习系列---- MOF文件能存储用户的密码吗?MOF文件里面能直接存储明文密码,这样是非常不安全的。那么有什么方式能够把MOF里面存...
  • chancein007
  • chancein007
  • 2017年02月24日 15:13
  • 1650

[23]Window PowerShell DSC学习系列---- MOF文件能存储用户的密码吗?

我们知道,DSC的资源中,有很多的资源是需要访问文件共享目录,进入本地的用户的目录,或者为一个特定的用户安装一个MSI的安装包,修改注册表;这个时候,如果直接执行调用DSC的资源,则可能会弹出“Acc...
  • chancein007
  • chancein007
  • 2017年02月21日 11:26
  • 1733

[26]Window PowerShell DSC学习系列----如何更换Pull服务器数据库为SQL Server数据库

上节我们提到了如何把PowerShell DSC的数据库换成Access;DSC Pull服务器当前的版本对MS SQL Server是不支持的,该怎么办?另外如果我们需要对Pull服务器建立负载均衡...
  • chancein007
  • chancein007
  • 2017年04月12日 17:59
  • 2186

[20]Window PowerShell DSC学习系列---- start-dscconfiguration 中遇到 Access Denied的解决方案

当我们执行start-DscConfiguration -computername psdsc-window201 -Path c:\DSC\TestFile -Wait -Verbose -forc...
  • chancein007
  • chancein007
  • 2016年11月10日 20:15
  • 2162

[28] Window PowerShell DSC 学习系列----如何用Java调用PowerShell DSC 5.x的oData服务

因为PowerShell DSC 5.x的Report是基于OData V3的标准,所以理论上只有odata4j和ODataJClient的框架支持V3版本;但是实际上odata4j宣传支持,其实代码...
  • chancein007
  • chancein007
  • 2017年05月21日 21:38
  • 2009
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:[27] Window PowerShell DSC 学习系列----DSC 5.x 查询节点注册和执行报告(Report)查询
举报原因:
原因补充:

(最多只允许输入30个字)