| A mild note of caution: The core features of ZeroDSC are implemented and working. Please experiment with ZeroDSC and provide feedback by opening issues and pull requests here. Please also note that it is still early days for this project and many of the features are still experimental and unpolished. Expect breaking changes to ZeroDSC before it stabilizes including changes to the configuration document format, live configuration objects, and the behaviour of the configuration algorithm. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if ($i -eq $null){$i = 8080} | |
| $i++ | |
| $Colors = @{ | |
| BackgroundColor = "#FF252525" | |
| FontColor = "#FFFFFFFF" | |
| } | |
| $NavBarLinks = @((New-UDLink -Text "<i class='material-icons' style='display:inline;padding-right:5px'>favorite_border</i> PowerShell Pro Tools" -Url "https://poshtools.com/buy-powershell-pro-tools/"), | |
| (New-UDLink -Text "<i class='material-icons' style='display:inline;padding-right:5px'>description</i> Documentation" -Url "https://adamdriscoll.gitbooks.io/powershell-tools-documentation/content/powershell-pro-tools-documentation/universal-dashboard.html")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Write-Log { | |
| param( | |
| [Parameter(position=0)][int]$ErrorLevel = 1, # 1 - info, 2 - warning, 3 - error | |
| [Parameter(position=1)][string]$Component ='AWEnroll', # source of the entry | |
| [Parameter(position=2)][string]$Msg, | |
| [Parameter(position=3)][string]$LogFile = "c:\utils\AW\Enroll.log" | |
| ) | |
| $TZBias = (Get-WmiObject Win32_TimeZone).bias | |
| $Time = "$(Get-Date -Format 'HH:mm:ss.fff')$TZBias" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use your module PSM1 to import functions, then run one or two if needed | |
| # Based on Warren Frame's Plaster module format | |
| # | |
| #Get public and private function definition files. | |
| $PublicFunction = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -Exclude *tests* -ErrorAction SilentlyContinue ) | |
| $PrivateFunction = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -Exclude *tests* -ErrorAction SilentlyContinue ) | |
| #Dot source the files | |
| Foreach($import in @($PublicFunction + $PrivateFunction)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Register the Microsoft RedHat repository | |
| curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo | |
| # Install PowerShell | |
| sudo yum install -y powershell | |
| # Start PowerShell | |
| powershell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| using System.Net; | |
| using System.Text; | |
| using System.Web; | |
| namespace Examples.System.Ham | |
| { | |
| public class WebRequestGetExample |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8" ?> | |
| <Types> | |
| <Type> | |
| <Name>AirWatch.Automation.Object.Device</Name> | |
| <Members> | |
| <ScriptProperty> | |
| <Name>AcLineStatus</Name> | |
| <GetScriptBlock> | |
| $this.AcLineStatus | |
| </GetScriptBlock> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Given an input CSV file like the following | |
| Profile,Hostname,IPAddress,OperatingSystem | |
| FoxDeploy-Manual_Patch,MEMWINREP002,192.168.16.64,Server2012 | |
| FoxDeploy-Manual_Patch,NASXCH1,192.168.17.10,Server2012 | |
| FoxDeploy-Manual_Patch,NASXCH3,192.168.16.112,Server2012 | |
| FoxDeploy-Manual_Patch,NASXCH2,192.168.16.55,Server2012 | |
| FoxDeploy-SQL,NASSQL03,192.168.16.110,Server2012 | |
| #define an XML file | |
| [xml]$xml = " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $keys = $PSCmdlet.MyInvocation.BoundParameters.Keys | |
| foreach ($key in $keys) | |
| { | |
| $keyValue = @{ | |
| $true = ",$key" | |
| $false = "?patchFields=$key" | |
| } | |
| $queryParams += $keyValue.($PSCmdlet.MyInvocation.BoundParameters.ContainsKey($key)) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PowerShell ALWAYS does its best to try to make sure it converts output into the most useful format. One of the ways it does this is by seeing the type of object that it is first displaying in a function, and ensuring that all future objects also match this format. Sometimes it's possible, and sometimes it's not. | |
| In the case of your code, PowerShell executes and then tries to emit the results of `Compare-Object`, and succeeds. 'Compare-Object' emits an object that has these properties. | |
| Name MemberType Definition | |
| ---- ---------- ---------- | |
| Equals Method bool Equals(System.Object obj) | |
| GetHashCode Method int GetHashCode() | |
| GetType Method type GetType() | |
| ToString Method str |