View DSC Applied to a Machine

View DSC Applied to a Machine

Learn how to check the DSC applied to a machine.

Q. How can I view the PowerShell DSC file applied to a server?

A. You cannot view the original DSC file used to configure a server. A PowerShell DSC file is converted to a MOF file specific to a host when the PowerShell DSC configuration is executed, and that MOF content is then applied to a server that consists of the various configurations. These configurations can be viewed using the Get-DscConfiguration cmdlet. An example is show below which shows the various configuration applied.

PS S:\Tools\DSC> Get-DscConfiguration


Credential : 
DisplayName : Web Server (IIS)
Ensure : Present
IncludeAllSubFeature : False
LogPath : 
Name : Web-Server
Source : 
PSComputerName : 

Credential : 
DisplayName : ASP.NET 4.5
Ensure : Present
IncludeAllSubFeature : False
LogPath : 
Name : Web-Asp-Net45
Source : 
PSComputerName : 

ApplicationPool : DefaultAppPool
BindingInfo : {MSFT_xWebBindingInformation}
Ensure : Present
Id : 1
Name : Default Web Site
PhysicalPath : C:\inetpub\wwwroot
State : Stopped
PSComputerName : 

Attributes : {directory}
Checksum : 
Contents : 
CreatedDate : 2/15/2015 8:28:04 AM
Credential : 
DestinationPath : C:\inetpub\SavillSite
Ensure : present
Force : 
MatchSource : 
ModifiedDate : 2/15/2015 8:28:04 AM
Recurse : 
Size : 0
SourcePath : 
SubItems : {MSFT_FileDirectoryConfiguration (DestinationPath = 
"C:\inetpub\SavillSite\header_main.jpg"), MSFT_FileDirectoryConfiguration 
(DestinationPath = "C:\inetpub\SavillSite\index.html")}
Type : directory
PSComputerName : 

ApplicationPool : DefaultAppPool
BindingInfo : {MSFT_xWebBindingInformation}
Ensure : Present
Id : 2
Name : SavillSite
PhysicalPath : C:\inetpub\SavillSite
State : Started
PSComputerName : 

In this example you can see that the IIS Web server and ASP.Net 4.5 are installed, the default website stopped, an alternate set of files present, and then a new website created using those files. This relates directly to the content in the original DSC and created MOF file.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish