full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod5/4.Config_Feature.ps1
4.Config_Feature.ps1
Configuration Demo_Feature { Import-DSCResource -ModuleName MVADemo Node s1 { MVAFeature Backup { FeatureName= 'web-server' Installed= $False Ensure = 'Present' } } } Demo_Feature -outputpath C:\Scripts\DSC2\mod5\config Start...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod5/3.LCM_Reboot.ps1
3.LCM_Reboot.ps1
Configuration LCM_Reboot { Node s1 { localconfigurationmanager { AllowModuleOverwrite = $True ConfigurationMode = 'ApplyAndAutoCorrect' RefreshMode = 'Push' Debugmode = 'All' RebootNodeIfNeeded = $True } } } LCM_Reboot -OutputPath C:\scripts\dsc2\M...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod5/_M5-Demo.ps1
_M5-Demo.ps1
# 1. Adding verbose and debug messages ise C:\Scripts\DSC2\Mod5\1.MVAServiceverbose.psm1 # Add the following code to Test-Target - this has error checking and verbose ise C:\scripts\DSC2\Mod5\2.Verbosetestcode.ps1 # 2. Adding help content ise C:\Scripts\DSC2\Mod5\about_MVADemo.help.txt # Create folder in ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod5/2.Verbosetestcode.ps1
2.Verbosetestcode.ps1
[CmdletBinding(SupportsShouldProcess=$true)] [OutputType([System.Boolean])] param ( #[parameter(Mandatory = $true)] [System.String] $ServiceName='bitsss', [ValidateSet("Running","Stopped")] [System.String] $Servicestatus='running', [ValidateSet("Present","Absent")] [System.String] $E...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod2/_M2_Demo.ps1
_M2_Demo.ps1
# Designing info URLs Start-Process -FilePath iexplore http://blogs.msdn.com/b/powershell/archive/2014/11/18/powershell-dsc-resource-design-and-testing-checklist.aspx Start-Process -FilePath http://blogs.msdn.com/b/powershell/archive/2014/11/19/documenting-dsc-part-2.aspx Start-Process -FilePath http://www.microsoft...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod6/_M6-Demo.ps1
_M6-Demo.ps1
# 1. Composite resource structure ise C:\Scripts\DSC2\Mod6\Config_composite.psm1 # Save as Baseconfig.schema.psm1 in folder structure copy-item C:\scripts\dsc2\mod6\Config_composite.psm1 -Destination C:\scripts\DSC2\Mod6\BaseConfig.schema.psm1 -force #Create new folder and copy composite resource New-Item -Path ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod6/WebConfig.ps1
WebConfig.ps1
Configuration WebServer { Import-DscResource -ModuleName CompositeDSC Node s1 { baseconfig Base { servicename = 'audiosrv' } WindowsFeature web { Name = 'web-server' Ensure = 'Present' } } } webserver -out...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod6/LCM_setup.ps1
LCM_setup.ps1
Configuration LCM_Reboot { Node s1 { localconfigurationmanager { AllowModuleOverwrite = $True ConfigurationMode = 'ApplyAndAutoCorrect' RefreshMode = 'Push' Debugmode = 'All' RebootNodeIfNeeded = $True } } } LCM_Reboot -OutputPath C:\scripts\dsc2\M...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod3/0.Config_SMBPullServer.ps1
0.Config_SMBPullServer.ps1
# Create folder and share on DC for MOF and Resource modules New-Item -Path C:\DSCSMB -ItemType Directory New-SmbShare -Name DSCSMB -Path c:\DSCSMB -ReadAccess Everyone -FullAccess Administrator -Description "SMB share for DSC"
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod3/_M3-Demo.ps1
_M3-Demo.ps1
# 1.Configuring SMB Pull Server - NO TARGET LCM Till next module # Create folder and share on DC for MOF and Resource modules New-Item -Path C:\DSCSMB -ItemType Directory New-SmbShare -Name DSCSMB -Path c:\DSCSMB -ReadAccess Everyone -FullAccess Administrator -Description "SMB share for DSC" # 2. Configurin...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod3/2.Config_HTTPSPullServer.ps1
2.Config_HTTPSPullServer.ps1
configuration HTTPSPullServer { # Modules must exist on target pull server Import-DSCResource -ModuleName xPSDesiredStateConfiguration Node s4 { WindowsFeature DSCServiceFeature { Ensure = "Present" Name = "DSC-Service" } WindowsFe...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod3/1.Config_HTTPPullServer.ps1
1.Config_HTTPPullServer.ps1
configuration HTTPPullServer { # Modules must exist on target pull server Import-DSCResource -ModuleName xPSDesiredStateConfiguration Node dc { WindowsFeature DSCServiceFeature { Ensure = "Present" Name = "DSC-Service" } WindowsFea...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod7/_M7-Demo.ps1
_M7-Demo.ps1
# NX is hostname, 192.168.3.20 # Copy Resource module and show. Copy-item -Path C:\Scripts\DSC1\Mod7\nx -Destination C:\Windows\System32\WindowsPowerShell\v1.0\Modules -Recurse -Force Get-DscResource # Get pre-req and build OMI Server Start-Process -FilePath iexplore http://blogs.technet.com/b/privatecloud...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod7/WordPressConfig.ps1
WordPressConfig.ps1
$OFS=[Environment]::Newline #Read Script elements from text files $ConfigGet = Get-Content "c:\scripts\DSC1\Mod7\scripts\get.txt" $ConfigSet = Get-Content "c:\scripts\DSC1\Mod7\scripts\set.txt" $ConfigTest = Get-Content "c:\scripts\DSC1\Mod7\scripts\test.txt" #Get WPConfig from file $WPConfig = Get-Content...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod7/ResetDSCDemo.ps1
ResetDSCDemo.ps1
$OFS=[Environment]::Newline #Read Script elements from text files $Get = Get-Content ".\reset\resetget.txt" $Set = Get-Content ".\reset\resetset.txt" $Test = Get-Content ".\reset\resettest.txt" #Get WPConfig from file $WPConfig = Get-Content ".\scripts\WP-Config.txt" #Define WordPress Server Configuration...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod7/WPDemoApply.ps1
WPDemoApply.ps1
$securePass=ConvertTo-SecureString -string "P@ssw0rd" -AsPlainText -Force $cred= New-Object System.Management.Automation.PSCredential "root", $SecurePass $opt = New-CimSessionOption -UseSsl:$true -SkipCACheck:$true -SkipCNCheck:$true -SkipRevocationCheck:$true $demo1=New-CimSession -Credential:$cred -ComputerNam...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod7/_NX_OMI.ps1
_NX_OMI.ps1
Start-Process -FilePath iexplore http://blogs.technet.com/b/privatecloud/archive/2014/05/19/powershell-dsc-for-linux-step-by-step.aspx # Do not run in Windows PowerShell -- CentOS 6 # 1. Install required Pre-Req packages yum groupinstall 'Development Tools' yum install pam-devel yum install openssl-devel yum ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/_IntroDemo/_M0-Demo.ps1
_M0-Demo.ps1
# Just after introduction # Quick Demo - Don't code - just show the idea - setting a service state. ise C:\Scripts\dsc1\_IntroDemo\Fast_Config_Demo.ps1 ise C:\Scripts\DSC1\_IntroDemo\s3.mof # Verify service is stopped and send new config Get-service -name bits -ComputerName s3 Start-DscConfiguration -Path C:\Sc...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/_IntroDemo/Fast_Config_Demo.ps1
Fast_Config_Demo.ps1
Configuration SetBits { Node s3 { Service bits { Name='bits' State='running' } } } Setbits -outputpath C:\Scripts\DSC1\Mod1
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod4/5.LCM_HTTPSPull.oldStyle.ps1
5.LCM_HTTPSPull.oldStyle.ps1
Configuration LCM_HTTPSPULL { param ( [Parameter(Mandatory=$true)] [string[]]$ComputerName, [Parameter(Mandatory=$true)] [string]$guid ) Node $ComputerName { LocalConfigurationManager { AllowModuleOverwrite = $True ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod4/2.Config_Backup.ps1
2.Config_Backup.ps1
configuration Backup { Node SMBComputers { WindowsFeature Backup{ Name = 'Windows-Server-Backup' Ensure = 'Present' } } } Backup -OutputPath C:\DSCSMB
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod4/_M4-Demo.ps1
_M4-Demo.ps1
# Demo for slides 2 and 3 of the module # LCM for SMB pull configuration Ise C:\Scripts\dsc1\Mod4\1.LCM_SMBPull.oldStyle.ps1 ise C:\Scripts\DSC1\Mod4\1.LCM_SMBPull.ps1 # Run # Can show MOF Explorer c:\DSCSMB # Send to computers LCM Set-DSCLocalConfigurationManager -ComputerName s1,s2 -Path c:\DSCSMB –Verbose...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod4/1.LCM_SMBPull.oldStyle.ps1
1.LCM_SMBPull.oldStyle.ps1
Configuration LCM_SMBPULL { param ( [Parameter(Mandatory=$true)] [string[]]$ComputerName, [Parameter(Mandatory=$true)] [string]$guid ) Node $ComputerName { LocalConfigurationManager { AllowModuleOverwrite = $True ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod4/3.LCM_HTTPPull.ps1
3.LCM_HTTPPull.ps1
[DSCLocalConfigurationManager()] Configuration LCM_HTTPPULL { param ( [Parameter(Mandatory=$true)] [string[]]$ComputerName, [Parameter(Mandatory=$true)] [string]$guid ) Node $ComputerName { Settings{ AllowModuleOverwr...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod4/3.LCM_HTTPPull.oldStyle.ps1
3.LCM_HTTPPull.oldStyle.ps1
Configuration LCM_HTTPPULL { param ( [Parameter(Mandatory=$true)] [string[]]$ComputerName, [Parameter(Mandatory=$true)] [string]$guid ) Node $ComputerName { LocalConfigurationManager { AllowModuleOverwrite = $True ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod4/4.Config_SMTP.ps1
4.Config_SMTP.ps1
configuration SMTP { Node HTTPComputers { WindowsFeature SMTP{ Name = 'SMTP-Server' Ensure = 'Present' } } } SMTP -OutputPath C:\DSC\HTTP
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod4/5.LCM_HTTPSPull.ps1
5.LCM_HTTPSPull.ps1
[DSCLocalConfigurationManager()] Configuration LCM_HTTPSPULL { param ( [Parameter(Mandatory=$true)] [string[]]$ComputerName, [Parameter(Mandatory=$true)] [string]$guid ) Node $ComputerName { Settings { AllowModuleOv...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod4/7.QueryNode.ps1
7.QueryNode.ps1
function QueryNodeInformation { Param ( [string] $Uri = "http://dc.company.pri:9080/PSDSCComplianceServer.svc/Status", [string] $ContentType = "application/json" ) Write-Output "Querying node information from pull server URI = $Uri" Write-Output "...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod4/1.LCM_SMBPull.ps1
1.LCM_SMBPull.ps1
[DSCLocalconfigurationManager()] Configuration LCM_SMBPULL { param ( [Parameter(Mandatory=$true)] [string[]]$ComputerName, [Parameter(Mandatory=$true)] [string]$guid ) Node $ComputerName { Settings { AllowModuleOverwri...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod4/6.Config_RemoveSMTP.ps1
6.Config_RemoveSMTP.ps1
configuration SMTP { Node HTTPSComputers { WindowsFeature SMTP{ Name = 'SMTP-Server' Ensure = 'Absent' } } } SMTP -OutputPath C:\DSC\HTTPS
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod1/_M1-Demo.ps1
_M1-Demo.ps1
# 1. Resources for DSC # Show web location of Reskit - Show Reskit Zip Find-Module -Name x* #(Also explain X and C) Find-DSCResource Find-Package # OneGet # 2. Requirements for DSC # show Remoting GPO - Computer Configuration/Policies/Administrative Templates/Windows Components/Windows Remote Management/W...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/1.LCM_Push.ps1
1.LCM_Push.ps1
[DSCLocalConfigurationManager()] Configuration LCM_Push { Node s1 { Settings { AllowModuleOverwrite = $True ConfigurationMode = 'ApplyAndAutoCorrect' RefreshMode = 'Push' } } } LCM_Push -ComputerName s1 -OutputPath C:\DSC\Mod5Config Set-DSCLocalCo...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/7.Config_Log.ps1
7.Config_Log.ps1
configuration TestLog { Node s1 { Log CreateLogEntry { Message = 'This DSC config worked!' } } } TestLog -OutputPath c:\DSC\Mod5Config Start-DscConfiguration -computername s1 -Path c:\dsc\Mod5Config -Wait -Verbose -force
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/3.Config_Archive.ps1
3.Config_Archive.ps1
configuration TestArchive { Node s1 { Archive Unzip{ Destination = 'C:\unzip' Path = 'c:\downloads\unzip.zip' Checksum = 'SHA-256' Validate = $true Force = $true Ensure = 'Present' } } } TestArchive -Outp...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/11.Config_Script.ps1
11.Config_Script.ps1
configuration TestScript { Node s1 { Script TestScript { GetScript = { @{ GetScript = $GetScript SetScript = $setScript TestScript = $TestScript Result = (Get-Service -name bits).status ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/2.Config_File.ps1
2.Config_File.ps1
configuration TestFile { Node s1 { File ZipFile { Ensure = "Present" Type = "Directory“ # Default is “File” Force = $True Recurse = $True SourcePath = '\\dc\Downloads' DestinationPath = 'C:\Downloads' # On S1 }...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/8.Config_WindowsProcess.ps1
8.Config_WindowsProcess.ps1
configuration TestProcess { Node s1 { WindowsProcess CreateNotepad { Path = 'notepad.exe' Arguments = '' } WindowsProcess CreatePaint { Path = 'mspaint.exe' Arguments = '' } } } TestProcess -OutputPath c:\DSC\Mo...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/10.Config_Registry.ps1
10.Config_Registry.ps1
configuration TestRegistry { Node s1 { Registry CreateReg { Key = 'HKEY_Local_Machine\Software\DSCTest' ValueName = 'DSCTestGood' ValueType = 'string' ValueData = 'True' } } } Testregistry -OutputPath c:\DSC\Mod5Config Start-Dsc...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/6.Config_Group.ps1
6.Config_Group.ps1
configuration TestGroup { Node s1 { Group CreateGroup { Ensure = 'Present' GroupName = 'TestGroup' Description = 'This is a DSC test group' Members = 'testuser','administrator' } } } TestGroup -OutputPath c:\DSC\Mod5Confi...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/5.Config_User.ps1
5.Config_User.ps1
configuration TestUser { Node s1 { User CreateUser { Ensure = "Present" UserName= 'TestUser' Description = 'This is a DSC test user' Disabled = $False PasswordChangeNotAllowed = $true PasswordNeverExpires = $False ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/4.Config_EnvironmentVar.ps1
4.Config_EnvironmentVar.ps1
configuration TestEnvVar { Node s1 { Environment NewVar{ Name = 'MYNEWVAR' Value = 'Value to store' Ensure = 'Present' } } } TestEnvVar -OutputPath c:\DSC\Mod5Config Start-DscConfiguration -computername s1 -Path c:\dsc\Mod5Config -Wait -Verbo...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/_M5-Demo.ps1
_M5-Demo.ps1
# 1. Built-in Resources Get-DscResource -name File | Select-Object -ExpandProperty Properties Get-DscResource -name File -Syntax # Discuss adding resources locally # discuss Adding resources to a pull server # Set for Push ise C:\Scripts\DSC1\Mod5\1.LCM_Push.ps1 # File ise C:\Scripts\DSC1\Mod5\2.Config...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod5/9.Config_WindowsService.ps1
9.Config_WindowsService.ps1
configuration TestService { Node s1 { Service StartAudio { Name = 'Audiosrv' State = 'Running' StartupType = 'Automatic' } } } TestService -OutputPath c:\DSC\Mod5Config Start-DscConfiguration -computername s1 -Path c:\dsc\Mod5Config -Wait -Ver...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod2/_M2-Demo.ps1
_M2-Demo.ps1
# 1.Writing a DSC Configuration Configuration Name{ Node s3 { WindowsFeature Demo{ } } } # 2.Configuring the LCM Get-Help *-DSC* Get-Help *localConfig* Get-DscLocalConfigurationManager -CimSession s1 # Describe basic settings - not too much right now #Script to change LCM t...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod2/1.LCM_Push_NewWay.ps1
1.LCM_Push_NewWay.ps1
[DSCLocalConfigurationManager()] Configuration LCMPUSH { Node $Computername { SEttings { AllowModuleOverwrite = $True ConfigurationMode = 'ApplyAndAutoCorrect' RefreshMode = 'Push' } } } $Computername = 's1','s2' # Create the Computer.Meta.Mof in folder LCMPush -OutputPa...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod2/2.SimpleConfig.ps1
2.SimpleConfig.ps1
configuration ConfigName { Node $ComputerName { WindowsFeature IIS{ Name = 'web-server' Ensure = 'Present' } } } $computername = 'S1','S2' ConfigName -OutputPath c:\DSC\Config
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod2/1.LCM_Push_Oldway.ps1
1.LCM_Push_Oldway.ps1
Configuration LCMPUSH { Node $Computername { LocalConfigurationManager { AllowModuleOverwrite = $True ConfigurationMode = 'ApplyAndAutoCorrect' RefreshMode = 'Push' } } } $Computername = 's1','s2' # Create the Computer.Meta.Mof in folder LCMPush -OutputPath c:\DSC\LCM ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod6/2b.Config_credential.ps1
2b.Config_credential.ps1
Configuration DirTest { param ( [pscredential]$credential ) Node S1 { File DirTest1 { DestinationPath = 'c:\DirTest' Type = 'Directory' Ensure = 'Present' Credential = $Credential } } } Dirtest -Credential (Get-Credenti...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod6/_M6-Demo.ps1
_M6-Demo.ps1
# 1.Parameterized configuration - REusable configurations ise C:\Scripts\DSC1\Mod6\1.config_param.ps1 # 2. Credentials ise C:\Scripts\DSC1\Mod6\2.config_Credentials.ps1 # Will Fail ise C:\Scripts\dsc1\mod6\2a.config_data.psd1 # Configuration Data ise C:\Scripts\dsc1\Mod6\2a.Config_credential.ps1 # Show it work...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod6/2a.Config_credential.ps1
2a.Config_credential.ps1
Configuration DirTest { param ( [pscredential]$credential ) Node S1 { File DirTest1 { DestinationPath = 'c:\DirTest' Type = 'Directory' Ensure = 'Present' Credential = $Credential } } } Dirtest -Credential (Get-Credenti...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod6/1.config_param.ps1
1.config_param.ps1
[DSCLocalConfigurationManager()] Configuration LCM_HTTPPULL { param ( [Parameter(Mandatory=$true)] [string[]]$ComputerName, [Parameter(Mandatory=$true)] [string]$guid ) Node $ComputerName { Settings { AllowModuleOverwri...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod6/3.config_DependsOn.ps1
3.config_DependsOn.ps1
Configuration InstallIIS { Node s1 { WindowsFeature IIS { Ensure = 'Present' Name = 'web-server' } WindowsFeature IISMgmt { Ensure = 'Present' Name = 'web-Mgmt-Service' DependsOn = "[WindowsFeature]IIS" } WindowsFeature IISConsole { Ensure ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod6/_ResetS1_LCM_Push.ps1
_ResetS1_LCM_Push.ps1
[DSCLocalConfigurationManager()] Configuration LCM_Push { Node s1 { Settings { AllowModuleOverwrite = $True ConfigurationMode = 'ApplyAndAutoCorrect' RefreshMode = 'Push' } } } LCM_Push -ComputerName s1 -OutputPath C:\DSC\Mod5Config Set-DSCLocalCo...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC1/Mod6/2.config_Credentials.ps1
2.config_Credentials.ps1
Configuration DirTest { param ( [pscredential]$credential ) Node S1 { File DirTest1 { DestinationPath = 'c:\DirTest' Type = 'Directory' Ensure = 'Present' Credential = $Credential } } } Dirtest -Credential (Get-Credenti...
PowerShellCorpus/PowerShellGallery/xNmap/1.0.7/Example/Sample_xNmap.ps1
Sample_xNmap.ps1
# Configuration sample for xNmap. # Vasken Houdoverdov # # Each of the calls to Sample_InstallxNmap will generate a MOF file which can be fed to Start-DscConfiguration # # Sample_InstallxNmap -VersionNumber "6.49BETA4" -LocalPath "C:\Windows\DtlDownloads\nmap-6.49beta4-setup.exe" # Sample_InstallxNmap -Version...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Out-TypeData.ps1
Out-TypeData.ps1
function Out-TypeData { <# .Synopsis Takes a series of type views and format actions and outputs a type data XML .Description Takes a series of type views and format actions and outputs a type data XML .Example # Create a quick view for any XML element. ...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Add-FormatData.ps1
Add-FormatData.ps1
function Add-FormatData { <# .Synopsis Adds formatting to the current session. .Description The Add-FormatData command gets the formatting data for the current session. The formatting data is defined in .Format.ps1xml files (such as those in the $pshome directory). ...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Get-FormatFile.ps1
Get-FormatFile.ps1
function Get-FormatFile { <# .Synopsis Gets format files .Description Gets loaded format files .Example Get-FormatFile .Example Get-FormatFile -OnlyFromModule .Example Get-FormatFile -OnlyBuildIn #> param( [Switch]$OnlyFromModul...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Clear-TypeData.ps1
Clear-TypeData.ps1
function Clear-TypeData { <# .Synopsis Clears formatting to the current session. .Description The Clear-FormatData command removes the formatting data for the current session. The formatting data must have been added with Add-FormatData .Link Add-TypeData .L...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Write-FormatTableView.ps1
Write-FormatTableView.ps1
function Write-FormatTableView { param( # The list of properties to export. [Parameter(ParameterSetName='PropertyTable', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [String[]]$Property, # If set, will rename the properties in the table. # The oldname is t...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Write-PowerShellHashtable.ps1
Write-PowerShellHashtable.ps1
function Write-PowerShellHashtable { <# .Synopsis Takes an creates a script to recreate a hashtable .Description Allows you to take a hashtable and create a hashtable you would embed into a script. Handles nested hashtables and indents nested hashtables automatically....
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Get-PropertySet.ps1
Get-PropertySet.ps1
function Get-PropertySet { <# .Synopsis Gets the property sets .Description Gets the property sets. Property sets are predefined views of an object. .Example Get-PropertySet .Example Get-PropertySet -TypeName System.Diagnostics.Process #> ...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Write-PropertySet.ps1
Write-PropertySet.ps1
function Write-PropertySet { <# .Synopsis Writes a property set .Description Writes a property set. Property sets are a way to conveniently access sets of properties on an object. Instead of writing: ...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Write-FormatView.ps1
Write-FormatView.ps1
function Write-FormatView { <# .Synopsis Creates a format XML that will be used to display a type. .Description Creates a format XML that will be used to display a type. Format XML is used by Windows PowerShell to determine how objects are displayed. ...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Show-CustomAction.ps1
Show-CustomAction.ps1
function Show-CustomAction { param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] [String] $ActionName, # If a property name is provided, then the custom action will show the contents # of the property [Parameter(Mandatory=$true, ParameterSetName=...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/New-EZFormatFile.ps1
New-EZFormatFile.ps1
None
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Write-CommandOverload.ps1
Write-CommandOverload.ps1
function Write-CommandOverload { <# .Synopsis Writes a command overload. .Description This creates a command that runs another command. It can optionally drop some parameters, or create new ones. .Example Write-CommandOverload -CommandName dir -NewTypeName myC...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Remove-TypeData.ps1
Remove-TypeData.ps1
function Remove-TypeData { <# .Synopsis Removes Type information from the current session. .Description The Remove-TypeData command removes the Typeting data for the current session. #> [CmdletBinding(DefaultParameterSetName="ByModule")] param( # The...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Remove-FormatData.ps1
Remove-FormatData.ps1
function Remove-FormatData { <# .Synopsis Removes formatting to the current session. .Description The Remove-FormatData command removes the formatting data for the current session. #> [CmdletBinding(DefaultParameterSetName="ByModule")] param( # The m...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Out-FormatData.ps1
Out-FormatData.ps1
function Out-FormatData { <# .Synopsis Takes a series of format views and format actions and outputs a format data XML .Description A Detailed Description of what the command does .Example # Create a quick view for any XML element. # Piping it i...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Write-TypeView.ps1
Write-TypeView.ps1
function Write-TypeView { <# .Synopsis Writes extended type view information .Description PowerShell has a robust, extensible types system. With Write-TypeView, you can easily add extended type information to any type. This can include: The default set of prope...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/ConvertTo-PropertySet.ps1
ConvertTo-PropertySet.ps1
function ConvertTo-PropertySet { <# .Synopsis Converts Select-Object results to a property set .Description Converts Select-Object results to a named property set Named property sets can be requested from a property .Example Get-ChildItem | Select-O...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Add-TypeData.ps1
Add-TypeData.ps1
function Add-TypeData { <# .Synopsis Adds type data to the current session. .Description The Add-TypeData command adds type data to the current session. .Link Clear-TypeData .Link Remove-TypeData .Link Out-TypeData #> [OutputT...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Clear-FormatData.ps1
Clear-FormatData.ps1
function Clear-FormatData { <# .Synopsis Clears formatting to the current session. .Description The Clear-FormatData command removes the formatting data for the current session. The formatting data must have been added with Add-FormatData .Example Clear-FormatDat...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Write-CustomAction.ps1
Write-CustomAction.ps1
function Write-CustomAction { [CmdletBinding(DefaultParameterSetName='Action')] param( # The script block used to fill in the contents of a custom control. # The script block can either be an arbitrary script, which will be run, or it can include a # number of speicalized commands that will t...
PowerShellCorpus/PowerShellGallery/EZOut/1.4/Find-FormatView.ps1
Find-FormatView.ps1
function Find-FormatView { <# .Synopsis Finds a format view for a typename .Description Finds a format view for a given typename .Example Find-FormatView System.Diagnostics.Process .Link Get-FormatFile #> param( # The name of the type of for...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/GenerateDockerfile.ps1
GenerateDockerfile.ps1
function GenerateDockerfile { <# .SYNOPSIS This function is responsible for generating a Dockerfile, based on a template. .PARAMETER ArtifactPath The filesystem path to the artifacts .PARAMETER ArtifactParam This is used for passing parameters to the resulting Generate functions...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/MountImage.ps1
MountImage.ps1
function MountImage { <# .SYNOPSIS Mounts a valid WIM or VHDX image to a directory. .PARAMETER ImagePath The filesystem path to the image file. .PARAMETER MountPath The directory that the image file will be mounted to. NOTE: This parameter is optional. If omitted, a direc...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/GetImageType.ps1
GetImageType.ps1
function GetImageType { <# .SYNOPSIS Retrieves the type of the image. .PARAMETER Path The path to the image file that will be inspected. .OUTPUTS This command emits a value from the [ImageType] enumeration #> [CmdletBinding()] param ( [ValidateScript({ ...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/GetDockerfileBuilder.ps1
GetDockerfileBuilder.ps1
function GetDockerfileBuilder { <# .SYNOPSIS Renders the content of the Dockerfile template .PARAMETER TemplateName Name of the template file. #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess",'')] [CmdletBinding()] param ( [Parameter(Mandatory = $false)] [string] $TemplateNam...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/GenerateOutputFolder.ps1
GenerateOutputFolder.ps1
function GenerateOutputFolder { <# .SYNOPSIS Generates an output folder for the Dockerfile and artifacts. .PARAMETER Path The path where all artifacts and the Dockerfile will be output to .PARAMETER Force Useful when you want to re-use a directory when testing functionality....
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/DiscoverArtifacts.ps1
DiscoverArtifacts.ps1
function DiscoverArtifacts { <# .SYNOPSIS Performs discovery of artifacts specified by user .PARAMETER Artifact This specifies which artifact/s that you are looking to discover .PARAMETER OutputPath This specifies where you want to output discovered items to. .PARAMETER ...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/SQLServer/Generate_SQLServer.ps1
Generate_SQLServer.ps1
function Generate_SQLServer { <# .SYNOPSIS Generates Dockerfile contents for Microsoft SQL Server .PARAMETER ManifestPath The filesystem path where the JSON manifests are stored. #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string] $MountPath, [Parameter(Mandatory = $true...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/SQLServer/Discover_SQLServer.ps1
Discover_SQLServer.ps1
Function Discover_SqlServer { <# .SYNOPSIS Scans for presence of the MSMQ Windows feature .PARAMETER MountPath The path where the Windows image was mounted to. .PARAMETER OutputPath The filesystem path where the discovery manifest will be emitted. #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSS...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/SQLServer/Tests/Generate_SQLServer.Tests.ps1
Generate_SQLServer.Tests.ps1
Describe 'Generate_SQLServer Tests' { Context 'Parameters for Generate_SQLServer'{ It 'Has a Parameter called ManifestPath' { $Function.Parameters.Keys.Contains('ManifestPath') | Should Be 'True' } It 'ManifestPath Parameter is Identified as Mandatory being True' { ...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/SQLServer/Tests/Discover_SqlServer.Tests.ps1
Discover_SqlServer.Tests.ps1
Describe 'Discover_SqlServer Tests' { Context 'Parameters for Discover_SqlServer'{ It 'Has a Parameter called MountPath' { $Function.Parameters.Keys.Contains('MountPath') | Should Be 'True' } It 'MountPath Parameter is Identified as Mandatory being True' { ...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/AllWindowsFeatures/Generate_AllWindowsFeatures.ps1
Generate_AllWindowsFeatures.ps1
function Generate_AllWindowsFeatures { <# .SYNOPSIS Generates Dockerfile contents for DHCP Server component .PARAMETER ManifestPath The filesystem path where the JSON manifests are stored. #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string] $MountPath, [Parameter(Mandato...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/AllWindowsFeatures/Discover_AllWindowsFeatures.ps1
Discover_AllWindowsFeatures.ps1
function Discover_AllWindowsFeatures { <# .SYNOPSIS Scans for presence of DHCP Server component in a Windows Server image. .PARAMETER MountPath The path where the Windows image was mounted to. .PARAMETER OutputPath The filesystem path where the discovery manifest will be emitted. #> [Diagnostics.CodeAnaly...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/AllWindowsFeatures/Tests/Generate_AllWindowsFeatures.Tests.ps1
Generate_AllWindowsFeatures.Tests.ps1
Describe 'Generate_AllWindowsFeatures Tests' { Context 'Parameters for Generate_AllWindowsFeatures'{ It 'Has a Parameter called ManifestPath' { $Function.Parameters.Keys.Contains('ManifestPath') | Should Be 'True' } It 'ManifestPath Parameter is Identified as Mandator...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/AllWindowsFeatures/Tests/Discover_AllWindowsFeatures.Tests.ps1
Discover_AllWindowsFeatures.Tests.ps1
Describe 'Discover_AllWindowsFeatures Tests' { Context 'Parameters for Discover_AllWindowsFeatures'{ It 'Has a Parameter called MountPath' { $Function.Parameters.Keys.Contains('MountPath') | Should Be 'True' } It 'MountPath Parameter is Identified as Mandatory being T...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/DHCPServer/Generate_DHCPServer.ps1
Generate_DHCPServer.ps1
function Generate_DHCPServer { <# .SYNOPSIS Generates Dockerfile contents for DHCP Server component .PARAMETER ManifestPath The filesystem path where the JSON manifests are stored. #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string] $MountPath, [Parameter(Mandatory = $tr...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/DHCPServer/Discover_DHCPServer.ps1
Discover_DHCPServer.ps1
function Discover_DHCPServer { <# .SYNOPSIS Scans for presence of DHCP Server component in a Windows Server image. .PARAMETER MountPath The path where the Windows image was mounted to. .PARAMETER OutputPath The filesystem path where the discovery manifest will be emitted. #> [Diagnostics.CodeAnalysis.Supp...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/DHCPServer/Tests/Generate_DHCPServer.Tests.ps1
Generate_DHCPServer.Tests.ps1
Describe 'Generate_DHCPServer Tests' { Context 'Parameters for Generate_DHCPServer'{ It 'Has a Parameter called ManifestPath' { $Function.Parameters.Keys.Contains('ManifestPath') | Should Be 'True' } It 'ManifestPath Parameter is Identified as Mandatory being True' { ...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/DHCPServer/Tests/Discover_DHCPServer.Tests.ps1
Discover_DHCPServer.Tests.ps1
Describe 'Discover_DHCPServer Tests' { Context 'Parameters for Discover_DHCPServer'{ It 'Has a Parameter called MountPath' { $Function.Parameters.Keys.Contains('MountPath') | Should Be 'True' } It 'MountPath Parameter is Identified as Mandatory being True' { ...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/Apache/Generate_Apache.ps1
Generate_Apache.ps1
function Generate_Apache { <# .SYNOPSIS Generates Dockerfile contents for Apache Web Server component .PARAMETER ManifestPath The filesystem path where the JSON manifests are stored. #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string] $MountPath, [Parameter(Mandatory = $...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/Apache/Discover_Apache.ps1
Discover_Apache.ps1
function Discover_Apache { <# .SYNOPSIS Scans for the Apache Web Server .PARAMETER MountPath The path where the Windows image was mounted to. .PARAMETER OutputPath The filesystem path where the discovery manifest will be emitted. #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess",'')]...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/Apache/Tests/Generate_Apache.Tests.ps1
Generate_Apache.Tests.ps1
Describe 'Generate_Apache Tests' { Context 'Parameters for Generate_Apache'{ It 'Has a Parameter called ManifestPath' { $Function.Parameters.Keys.Contains('ManifestPath') | Should Be 'True' } It 'ManifestPath Parameter is Identified as Mandatory being True' { ...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/Apache/Tests/Discover_Apache.Tests.ps1
Discover_Apache.Tests.ps1
Describe 'Discover_Apache Tests' { Context 'Parameters for Discover_Apache'{ It 'Has a Parameter called MountPath' { $Function.Parameters.Keys.Contains('MountPath') | Should Be 'True' } It 'MountPath Parameter is Identified as Mandatory being True' { [Str...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/AddRemovePrograms/Discover_AddRemovePrograms.ps1
Discover_AddRemovePrograms.ps1
function Discover_AddRemovePrograms { <# .SYNOPSIS Scans for Add/Remove Programs entries .PARAMETER MountPath The path where the Windows image was mounted to. .PARAMETER OutputPath The filesystem path where the discovery manifest will be emitted. #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSSho...
PowerShellCorpus/PowerShellGallery/Image2Docker/1.8.2/Functions/Private/Artifacts/AddRemovePrograms/Generate_AddRemovePrograms.ps1
Generate_AddRemovePrograms.ps1
function Generate_AddRemovePrograms { <# .SYNOPSIS Generate Dockerfile contents for Add/Remove Programs entries .PARAMETER ManifestPath The filesystem path where the JSON manifests are stored. #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string] $MountPath, [Parameter(Man...