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/Reskit9/All Resources/xPSDesiredStateConfiguration/Examples/Sample_xFileUpload.ps1
Sample_xFileUpload.ps1
Configuration FileUploadConfiguration { param ( [parameter(Mandatory = $true)] [String] $destinationPath, [parameter(Mandatory = $true)] [String] $sourcePath, [PSCredential] $credential, [String] $certificateThumbprint ) Import-DscResource -modulename xPSDesiredStateConfiguration node localhost { ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xPSDesiredStateConfiguration/ResourceDesignerScripts/New-PSSessionConfigurationResource.ps1
New-PSSessionConfigurationResource.ps1
ipmo xDSCResourceDesigner $resProperties = @{ Name = New-xDscResourceProperty -Description 'Name of the PS Remoting Endpoint' ` -Name Name -Type String -Attribute Key RunAsCred = New-xDscResourceProperty -Description 'Credential for Running under d...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xPSDesiredStateConfiguration/ResourceDesignerScripts/GenerateXRemoteFileSchema.ps1
GenerateXRemoteFileSchema.ps1
$DestinationPath = New-xDscResourceProperty -Name DestinationPath -Type String -Attribute Key -Description 'Path under which downloaded or copied file should be accessible after operation.' $Uri = New-xDscResourceProperty -Name Uri -Type String -Attribute Required -Description 'Uri of a file which should be copied or ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWinEventLog/Examples/Demo1.ps1
Demo1.ps1
cls $before = Get-WinEvent -ListLog "Microsoft-Windows-MSPaint/Admin" configuration Demo1 { Import-DscResource -module xWinEventLog xWinEventLog Demo1 { LogName = "Microsoft-Windows-MSPaint/Admin" IsEnabled = $true LogMode = "AutoBackup" ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xPowerShellExecutionPolicy/Examples/SetPowerShellExecutionPolicy.ps1
SetPowerShellExecutionPolicy.ps1
#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, #wit...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xBitlocker/Test/Test-xBitlocker.ps1
Test-xBitlocker.ps1
$showVerbose = $true #Define the parameters that can be passed into individual tests $blParams1 = @{ MountPoint = "C:" PrimaryProtector = "RecoveryPasswordProtector" StartupKeyProtector = $true StartupKeyPath = "A:" RecoveryPasswordProtector = $true AllowImmediateReboot = $false U...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xBitlocker/Examples/ConfigureBitlockerOnOSDrive/ConfigureBitlockerOnOSDrive.ps1
ConfigureBitlockerOnOSDrive.ps1
Configuration ConfigureBitlockerOnOSDrive { Import-DscResource -Module xBitlocker Node "E15-1" { #First install the required Bitlocker features WindowsFeature BitlockerFeature { Name = 'Bitlocker' Ensure = 'Present' ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xBitlocker/Examples/ConfigureBitlockerAndAutoBitlocker/ConfigureBitlockerAndAutoBitlocker.ps1
ConfigureBitlockerAndAutoBitlocker.ps1
Configuration ConfigureBitlockerAndAutoBitlocker { Import-DscResource -Module xBitlocker Node 'E15-1' { #First install the required Bitlocker features WindowsFeature BitlockerFeature { Name = 'Bitlocker' Ensure = 'Prese...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xMySql/DscResources/MSFT_xMySqlDatabase/xMySqlDatabaseDesigner.ps1
xMySqlDatabaseDesigner.ps1
# a Powershell script to create MySqlDatabase resource using xDSCResourceDesigner tool $friendlyName = "xMySqlDatabase" $resourceName = "MSFT_$friendlyName" $classVersion = "1.0.0" $scriptRoot = Split-Path $MyInvocation.MyCommand.Path $originalModuleRoot = join-Path $scriptroot "..\.." $originalModuleRootPath =...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xMySql/DscResources/MSFT_xMySqlUser/xMySqlUserDesigner.ps1
xMySqlUserDesigner.ps1
# a Powershell script to create MySqlDatabase resource using xDSCResourceDesigner tool $friendlyName = "xMySqlGrant" $resourceName = "MSFT_$friendlyName" $classVersion = "1.0.0" $scriptRoot = Split-Path $MyInvocation.MyCommand.Path $originalModuleRoot = join-Path $scriptroot "..\.." $originalModuleRootPath = Re...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xMySql/DscResources/MSFT_xMySqlGrant/xMySqlGrantDesigner.ps1
xMySqlGrantDesigner.ps1
# a Powershell script to create MySqlDatabase resource using xDSCResourceDesigner tool $friendlyName = "xMySqlGrant" $resourceName = "MSFT_$friendlyName" $classVersion = "1.0.0" $scriptRoot = Split-Path $MyInvocation.MyCommand.Path $originalModuleRoot = join-Path $scriptroot "..\.." $originalModuleRootPath = Re...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xMySql/Examples/Sample_InstallMySQL_Default.ps1
Sample_InstallMySQL_Default.ps1
configuration SQLInstanceInstallationConfiguration { param ( [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $MySQLInstancePackagePath, [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $MySQLInstancePackageName ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xMySql/Examples/Sample_InstallMySQLInstanceAndDatabase.ps1
Sample_InstallMySQLInstanceAndDatabase.ps1
configuration SQLInstanceAndDatabaseInstallationConfiguration { param ( [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $MySQLInstancePackagePath, [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $MySQLInstancePackag...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xMySql/Examples/InstallRequiredModules.ps1
InstallRequiredModules.ps1
# This Script installs the required modules for the MySql Sample # It uses the PowerShell Resource Gallery, see https://msconfiggallery.cloudapp.net/ # This requires WMF 5. If you don't have WMF 5, Please install the modules manually. Write-Host "Installing required modules..." Install-Module xMySql -MinimumVers...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xMySql/Examples/GrantMySqlDatabaseAccess.ps1
GrantMySqlDatabaseAccess.ps1
################### # Configuration script to grant full access to given my sql database for given my sql user. # It assumes that mySql is installed on local machine with root user $RootUser and root password $global:pwd ################### configuration MySQLGrantConfiguration { param ( [par...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xMySql/Examples/Sample_RemoveMySQL_Default.ps1
Sample_RemoveMySQL_Default.ps1
configuration SQLInstanceRemovalConfiguration { Import-DscResource -Module xMySql node $AllNodes.NodeName { xMySqlServer MySQLInstance { Ensure = "Absent" RootPassword = $global:cred ServiceName = "MySQLInstanceServiceName"...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xMySql/Examples/CreateMySQLUser.ps1
CreateMySQLUser.ps1
################### # Configuration script to create my sql user. It assumes that mySql is installed on local machine with root user $RootUser and root password $global:pwd ################### configuration CreateMySQLUserConfiguration { param ( [parameter(Mandatory = $true)] [Validate...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xMySql/Examples/Sample_RemoveMySQLAndDatabase.ps1
Sample_RemoveMySQLAndDatabase.ps1
configuration SQLRemoveInstanceAndDatabaseInstallationConfiguration { param ( [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $MySQLInstancePackagePath, [parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $MySQLInstance...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xActiveDirectory/Assert-HADC.ps1
Assert-HADC.ps1
# A configuration to Create High Availability Domain Controller $secpasswd = ConvertTo-SecureString "Adrumble@6" -AsPlainText -Force $domainCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) $safemodeAdministratorCred = New-Object System.Management.Automation.PSCr...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xActiveDirectory/Assert-ParentChildDomains.ps1
Assert-ParentChildDomains.ps1
$secpasswd = ConvertTo-SecureString "Adrumble@6" -AsPlainText -Force $domainCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) $safemodeAdministratorCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) $localcred = New-...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xActiveDirectory/Misc/New-ADDomainTrust.ps1
New-ADDomainTrust.ps1
$Properties = @{ SourceDomain = New-xDscResourceProperty -Name SourceDomainName -Type String -Attribute Key ` -Description 'Name of the AD domain that is requesting the trust' TargetDomain = New-xDscResourceProperty -Nam...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAdcsDeployment/xCertificateServices/Examples/Config-SetupActiveDirectory.ps1
Config-SetupActiveDirectory.ps1
#region Param param ( [String]$DomainName, [String]$DomainNetbiosName, [PSCredential]$Credential, [PSCredential]$DomainCredential, [PSCredential]$SafeModeAdministratorPassword, [String]$EncryptionCertificateThumbprint ) #endregion #region Decrypt function De...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/Status.ps1
Status.ps1
############################################################ # DSC Azure Test Example - Status # # This script will show the detailed status of the Virtual # Machine in Azure. # # Before running this script, do the following: # * Open PowerShell and run Get-AzurePublishSettingsFile # * Download the .publishsetting...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/CreateWithDSCExtension.ps1
CreateWithDSCExtension.ps1
############################################################ # DSC Azure Test Example - CREATEwithDSCExtension # # This script will create a test Virtual Machine in Azure, # including the prerequisites - Affinity Group, Storage, # and Cloud Service. # # This example also loads PowerShell Just Enough Administration # in...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/LCM.ps1
LCM.ps1
############################################################ # DSC Azure Test Example - LCM Apply Only # # This script configures your local machine to apply DSC # configurations 'only' which means not to include # DSC automatically monitoring for drift or # re-applying the configuration automationally. # # Set the...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/Create_SqlDatabase.ps1
Create_SqlDatabase.ps1
<# Configuration creates Azure SQL Database #> configuration CreateSqlDatabase { param ( $workingDirectory, $name, $serverCredential, $serverName, $ruleName, $startIPAddress, $endIPAddress, $azureSubscriptionName, $azure...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/SetupSubscription.ps1
SetupSubscription.ps1
############################################################ # DSC Azure Test Example - SETUP SUBSCRIPTION # # Before running this script, do the following: # * Open PowerShell and run Get-AzurePublishSettingsFile # * Download the .publishsettings file in to $workingdir # # Set the folder where your files will liv...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/Destroy.ps1
Destroy.ps1
############################################################ # DSC Azure Test Example - DESTROY # # NOTES - this script removes everything in the test environment # from Azure and then makes sure the subscription is no longer # set as Current for the LocalSystem. # # This script is DESTRUCTIVE without a method of resto...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/RemoveVMs.ps1
RemoveVMs.ps1
############################################################ # DSC Azure Test Example - REMOVE VMS # # This script removes specific VMs from Azure # # This script is DESTRUCTIVE without a method of restoration # # The subscription must be in place in order to access Azure # and do work, so if this is being run in a new...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/PublishConfigurationArchiveToStorage.ps1
PublishConfigurationArchiveToStorage.ps1
# Sample configuration to Publish Configuration Archive to Storage Configuration PublishToStorage { Import-DscResource -Module xAzure xAzureVMDscConfiguration Publish { StorageAccountName = 'dscazext' Ensure = 'Present' ContainerName ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/Create.ps1
Create.ps1
############################################################ # DSC Azure Test Example - CREATE # # This script will create a test Virtual Machine in Azure, # including the prerequisites - Affinity Group, Storage, # and Cloud Service. # # This example also loads PowerShell Just Enough Administration # inside the VM via ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/Create_FirewallRule.ps1
Create_FirewallRule.ps1
<# Configuration creates Azure SQL Database Server Firewall Rule #> configuration CreateSqlDatabaseServerFirewallRule { param ( $workingDirectory, $ruleName, $serverName, $startIPAddress, $endIPAddress, $azureSubscriptionName, $azurePubli...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/scriptextensionfiles/InstallJEA.ps1
InstallJEA.ps1
Invoke-WebRequest -Uri 'http://nuget.org/nuget.exe' -OutFile "$env:TEMP\NuGet.exe" &"$env:TEMP\NuGet.exe" install xJea -NoCache -Source http://msconfiggallery.cloudapp.net/api/v2/ -ExcludeVersion -PackageSaveMode "nuspec" -OutputDirectory "$env:ProgramFiles\WindowsPowerShell\Modules" &'winrm' quickconfig -quiet ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/Examples/ServerCoreTest/ServerCoreTest.ps1
ServerCoreTest.ps1
configuration ServerCoreTest { WindowsFeature NoGUI { Ensure = 'Absent' Name = 'Server-Gui-Mgmt-Infra' } LocalConfigurationManager { ConfigurationMode = 'ApplyOnly' RebootNodeIfNeeded = 'True' } }
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/ResourceDesignerScripts/GenerateXAzureSqlDatabase.ps1
GenerateXAzureSqlDatabase.ps1
$Name = New-xDscResourceProperty -Name Name -Type String -Attribute Key -Description 'Name of the database' $ServerName = New-xDscResourceProperty -Name ServerName -Type String -Attribute Key -Description 'Name of the database server in which database should be created' $MaximumSizeInGB = New-xDscResourceProperty -N...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xAzure/ResourceDesignerScripts/GenerateXAzureSqlDatabaseServerFirewallRule.ps1
GenerateXAzureSqlDatabaseServerFirewallRule.ps1
$Name = New-xDscResourceProperty -Name RuleName -Type String -Attribute Key -Description 'Name of the firewall rule' $ServerName = New-xDscResourceProperty -Name ServerName -Type String -Attribute Key -Description 'Name of the database server for which firewall rule should be created' $StartIPAddress = New-xDscResour...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCOM/Examples/SCOM-SeperateSQL-TP.ps1
SCOM-SeperateSQL-TP.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCOM/Examples/SCOM-SeperateSQL.ps1
SCOM-SeperateSQL.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCOM/Examples/SCOM-SeperateSQLInstances-TP.ps1
SCOM-SeperateSQLInstances-TP.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCOM/Examples/SCOM-MultiInstance-TP.ps1
SCOM-MultiInstance-TP.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCOM/Examples/SCOM-SingleServer-TP.ps1
SCOM-SingleServer-TP.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCOM/Examples/SCOM-MultiInstance.ps1
SCOM-MultiInstance.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCOM/Examples/SCOM-SeperateSQLInstances.ps1
SCOM-SeperateSQLInstances.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCOM/Examples/SCOM-SingleServer.ps1
SCOM-SingleServer.ps1
#requires -Version 5 Configuration OM { Import-DscResource -Module xCredSSP Import-DscResource -Module xSQLServer Import-DscResource -Module xSCOM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($A...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xRemoteDesktopAdmin/Examples/ExampleConfiguration-RemoteDesktopAdmin.ps1
ExampleConfiguration-RemoteDesktopAdmin.ps1
Configuration AllowRemoteDesktopAdminConnections { Import-DscResource -Module xRemoteDesktopAdmin, xNetworking Node ('localhost') { xRemoteDesktopAdmin RemoteDesktopSettings { Ensure = 'Present' UserAuthentication = 'Secure' } xFire...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xRemoteDesktopAdmin/Examples/ExampleConfiguration-RemoteDesktopAdminWithEncryptedPassword.ps1
ExampleConfiguration-RemoteDesktopAdminWithEncryptedPassword.ps1
# The configuration data section specifies which certificate and thumbprint to use for encrypting the password $ConfigData = @{ AllNodes = @( @{ NodeName="DSCnode1"; CertificateFile = "C:\Certificates\DSCnode1.cer" Thumbprint = "E36D15C59BDBABB8525E48568844DD7079C1...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xRemoteDesktopAdmin/Examples/ExampleConfiguration-RemoteDesktopAdminWithUnEncryptedPassword.ps1
ExampleConfiguration-RemoteDesktopAdminWithUnEncryptedPassword.ps1
# The configuration data section specifies to allow using a plain text stored password $ConfigData = @{ AllNodes = @( @{ NodeName="DSCnode1"; PSDscAllowPlainTextPassword = $true } )} Configuration AllowRemoteDesktopAdminConnections { $password...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/cFileShare/Examples/Sample - CreateMultipleShares.ps1
Sample - CreateMultipleShares.ps1
Configuration CreateMultipleShares { Import-DscResource -ModuleName cFileShare node [target server name] { cCreateFileShare CreateShare { ShareName = '[share name]' Path = '[folder path]' Ensure = 'Present' } cCreateF...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/cFileShare/Examples/Sample - CreateDropShare.ps1
Sample - CreateDropShare.ps1
Configuration CreateDropShare { Import-DscResource -ModuleName cFileShare node [target server name] { cCreateFileShare CreateShare { ShareName = '[share name]' Path = '[folder path]' Ensure = 'Present' } cSetSharePerm...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/cFileShare/Examples/Sample - AlterPermissions.ps1
Sample - AlterPermissions.ps1
Configuration AlterPermissions { Import-DscResource -ModuleName cFileShare node [target server name] { cSetSharePermissions SetPermissions { ShareName = '[Share name]' Ensure = 'Absent' FullAccessUsers = @('[user 1]') ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/cFileShare/ResourceDesignerScripts/Generate_VSAR_cFileShare_Schema.ps1
Generate_VSAR_cFileShare_Schema.ps1
#This creates the definition for the resource #The share to create $ShareName = New-xDscResourceProperty -Name ShareName -Type String -Attribute Key #The path where the folder that maps to the share should be created $Path = New-xDscResourceProperty -Name Path -Type String -Attribute Required #Identify ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/cFileShare/Unit Tests/VSAR_cSetSharePermissions_UnitTests.ps1
VSAR_cSetSharePermissions_UnitTests.ps1
#Unit tests for VSAR_cSetSharePermissions Import-Module "C:\Program Files\WindowsPowerShell\Modules\cFileShare\DSCResources\VSAR_cSetSharePermissions" #Variable Declarations $ShareName = "TestShare" $Users = @("[domain]\[user1]", "[domain]\[user2]") $Path = "C:\Test" $User1 = "[domain]\[user1]" $User2 = "[doma...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/cFileShare/Unit Tests/VSAR_cCreateFileShare_UnitTests.ps1
VSAR_cCreateFileShare_UnitTests.ps1
#Unit tests for VSAR_cCreateFileShare Import-Module "C:\Program Files\WindowsPowerShell\Modules\cFileShare\DSCResources\VSAR_cCreateFileShare" #Variable Declarations $ShareName = "TestShare" $Path = "C:\Test" $PassCounter = 0 $FailCounter = 0 ############################## # # Tests for Get-TargetResourc...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCDPM/Examples/SCDPM-MultiInstance.ps1
SCDPM-MultiInstance.ps1
#requires -Version 5 Configuration DPM { Import-DscResource -Module xDismFeature Import-DscResource -Module xSqlServer Import-DscResource -Module xSCDPM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCDPM/Examples/SCDPM-SingleServer-TP.ps1
SCDPM-SingleServer-TP.ps1
#requires -Version 5 Configuration DPM { Import-DscResource -Module xDismFeature Import-DscResource -Module xSqlServer Import-DscResource -Module xSCDPM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCDPM/Examples/SCDPM-SingleServer.ps1
SCDPM-SingleServer.ps1
#requires -Version 5 Configuration DPM { Import-DscResource -Module xDismFeature Import-DscResource -Module xSqlServer Import-DscResource -Module xSCDPM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCDPM/Examples/SCDPM-SeperateSQL-TP.ps1
SCDPM-SeperateSQL-TP.ps1
#requires -Version 5 Configuration DPM { Import-DscResource -Module xDismFeature Import-DscResource -Module xSqlServer Import-DscResource -Module xSCDPM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCDPM/Examples/SCDPM-MultiInstance-TP.ps1
SCDPM-MultiInstance-TP.ps1
#requires -Version 5 Configuration DPM { Import-DscResource -Module xDismFeature Import-DscResource -Module xSqlServer Import-DscResource -Module xSCDPM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSCDPM/Examples/SCDPM-SeperateSQL.ps1
SCDPM-SeperateSQL.ps1
#requires -Version 5 Configuration DPM { Import-DscResource -Module xDismFeature Import-DscResource -Module xSqlServer Import-DscResource -Module xSCDPM # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xInternetExplorerHomePage/Examples/SetIEhomePage.ps1
SetIEhomePage.ps1
#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, #wit...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWordPress/DscResources/MSFT_xWordPressSite/xWordPressSite.ps1
xWordPressSite.ps1
# Sample script to create the template or update the Wordpress Resource # Resource Details # Friendly name of the resource: $friendlyName = "xWordPressSite" # Name of the resource: $resourceName = "MSFT_$friendlyName" # Class Version of the resource: $classVersion = "1.0.0" # Various Paths $diff = join-...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWordPress/samples/WordPressConfigurationTemplate.ps1
WordPressConfigurationTemplate.ps1
# Generate a WordPress configuration base on the supplied parameters # and returns it as a string. param ( [Parameter(Mandatory = $true)] [string] $WordPressDatabase, [Parameter(Mandatory = $true)] [string] $WordPressUserName, [Parameter(Mandatory = $true)] [...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWordPress/samples/InstallRequiredModules.ps1
InstallRequiredModules.ps1
# This Script installs the required modules for the WordPress Sample # It uses the PowerShell Resource Gallery, see https://msconfiggallery.cloudapp.net/ # This requires WMF 5. If you don't have WMF 5, Please install the modules manually. Write-Host "Installing required modules..." Install-Module xWebAdministrat...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWordPress/samples/SingleNodeEndToEndWordPress.ps1
SingleNodeEndToEndWordPress.ps1
# This configuration configures a Basic WordPress Site # It requires xPhp, xMySql, xWordPress, and xWebAdministration # Please review the note about the FQDN variable and # about the URLs, they may need to be updated. # ********* NOTE *********** # If you are not targetting the local machine, # or this does no...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWindowsRestore/Examples/ConfigureSystemRestore.ps1
ConfigureSystemRestore.ps1
#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, #wit...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWindowsRestore/Examples/CreateSystemRestorePoint.ps1
CreateSystemRestorePoint.ps1
#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, #wit...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xTimeZone/Example/SetTimeZone.ps1
SetTimeZone.ps1
#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, #wit...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWebAdministration/Examples/Sample_xWebsite_NewWebsiteFromConfigurationData.ps1
Sample_xWebsite_NewWebsiteFromConfigurationData.ps1
Configuration Sample_xWebsite_FromConfigurationData { # Import the module that defines custom resources Import-DscResource -Module xWebAdministration # Dynamically find the applicable nodes from configuration data Node $AllNodes.where{$_.Role -eq "Web"}.NodeName { # Install the IIS ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWebAdministration/Examples/Sample_xWebsite_NewWebsite.ps1
Sample_xWebsite_NewWebsite.ps1
configuration Sample_xWebsite_NewWebsite { param ( # Target nodes to apply the configuration [string[]]$NodeName = 'localhost', # Name of the website to create [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [String]$WebSiteName, # Source P...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWebAdministration/Examples/Sample_xWebsite_RemoveDefault.ps1
Sample_xWebsite_RemoveDefault.ps1
configuration Sample_xWebsite_StopDefault { param ( # Target nodes to apply the configuration [string[]]$NodeName = 'localhost' ) # Import the module that defines custom resources Import-DscResource -Module xWebAdministration Node $NodeName { # Install ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSqlPs/Samples/sql101.ps1
sql101.ps1
# Configuration to install Sql server database engine and management tools. # # A. Prepare a local self signed certificate with the following steps: # 1. Get MakeCert.exe if you don't have. ( MakeCert.exe is shipped with windows SDK: http://msdn.microsoft.com/en-us/windows/desktop/bg162891.aspx) # 2. Open console ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWindowsUpdate/Examples/Sample_xWindowsUpdateFromPath.ps1
Sample_xWindowsUpdateFromPath.ps1
<# # This sample looks at installing a particular windows update. However, the path and ID properties can be changed # as per the hotfix that you want to install #> Configuration DownloadHotfixFromPath { xHotfix m1 { Path = "c:\WindowsBlue-KB2937982-x64.msu" Id = "KB2937982" ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xWindowsUpdate/Examples/Sample_xWindowsUpdateFromURI.ps1
Sample_xWindowsUpdateFromURI.ps1
<# # This sample looks at installing a particular windows update. However, the URI and ID properties can be changed # as per the hotfix that you want to install #> Configuration DownloadHotfixFromURI { xHotfix m1 { Uri = "http://hotfixv4.microsoft.com/Microsoft%20Office%20SharePoint%20Serv...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xNetworking/Examples/Sample_xIPAddress_FixedValue.ps1
Sample_xIPAddress_FixedValue.ps1
configuration Sample_xIPAddress_FixedValue { param ( [string[]]$NodeName = 'localhost' ) Import-DscResource -Module xNetworking Node $NodeName { xIPAddress NewIPAddress { IPAddress = "2001:4898:200:7:6c71:a102:ebd8:f482" Interf...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xNetworking/Examples/Sample_xDnsServerAddress.ps1
Sample_xDnsServerAddress.ps1
configuration Sample_xDnsServerAddress { param ( [string[]]$NodeName = 'localhost', [Parameter(Mandatory)] [string]$DnsServerAddress, [Parameter(Mandatory)] [string]$InterfaceAlias, [ValidateSet("IPv4","IPv6")] [string]$AddressFamily = 'IPv...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xNetworking/Examples/Sample_xFirewall_DisableAccessToApplication.ps1
Sample_xFirewall_DisableAccessToApplication.ps1
# DSC configuration for Firewall # configuration Sample_xFirewall_AddFirewallRuleToNewGroup { param ( [string[]]$NodeName = 'localhost' ) Import-DSCResource -ModuleName xNetworking Node $NodeName { xFirewall Firewall { Name ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xNetworking/Examples/Sample_xFirewall_AddFirewallRule.ps1
Sample_xFirewall_AddFirewallRule.ps1
# DSC configuration for Firewall configuration Sample_xFirewall_AddFirewallRule { param ( [string[]]$NodeName = 'localhost' ) Import-DSCResource -ModuleName xNetworking Node $NodeName { xFirewall Firewall { Name = "NotePadFi...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xNetworking/Examples/Sample_xIPAddress_Parameterized.ps1
Sample_xIPAddress_Parameterized.ps1
configuration Sample_xIPAddress_Parameterized { param ( [string[]]$NodeName = 'localhost', [Parameter(Mandatory)] [string]$IPAddress, [Parameter(Mandatory)] [string]$InterfaceAlias, [Parameter(Mandatory)] [string]$DefaultGateway, ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xNetworking/Examples/Sample_xFirewall_AddFirewallRuleToExistingGroup.ps1
Sample_xFirewall_AddFirewallRuleToExistingGroup.ps1
# DSC configuration for Firewall # configuration Sample_xFirewall_AddFirewallRuleToExistingGroup { param ( [string[]]$NodeName = 'localhost' ) Import-DSCResource -ModuleName xNetworking Node $NodeName { xFirewall Firewall { Name ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xNetworking/Examples/Sample_xFirewall_AddFirewallRuleToNewGroup.ps1
Sample_xFirewall_AddFirewallRuleToNewGroup.ps1
# DSC configuration for Firewall configuration Sample_xFirewall_AddFirewallRuleToNewGroup { param ( [string[]]$NodeName = 'localhost' ) Import-DSCResource -ModuleName xNetworking Node $NodeName { xFirewall Firewall { Name = ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSQLServer/Examples/SQL-ClusterDB.ps1
SQL-ClusterDB.ps1
#requires -Version 5 Configuration SQL { Import-DscResource -Module xSQLServer Import-DscResource -Module xFailoverCluster Node $AllNodes.NodeName { # Set LCM to reboot if needed LocalConfigurationManager { DebugMode = $true RebootNodeIfNeed...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/Reskit9/All Resources/xSQLServer/Examples/SQL-Standalone.ps1
SQL-Standalone.ps1
#requires -Version 5 Configuration SQLSA { Import-DscResource -Module xSQLServer # Set role and instance variables $Roles = $AllNodes.Roles | Sort-Object -Unique foreach($Role in $Roles) { $Servers = @($AllNodes.Where{$_.Roles | Where-Object {$_ -eq $Role}}.NodeName) Set...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod3/Config_Feature.ps1
Config_Feature.ps1
Configuration Demo_Feature { Import-DSCResource -ModuleName MVADemo Node s1 { MVAFeature Backup { FeatureName= 'windows-server-backup' Installed= $True Ensure = 'Present' } } } Demo_Feature Start-DscConfiguration -Path .\Demo...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod3/LCM_HTTPPull.ps1
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/DSC2/Mod3/Config_Service.ps1
Config_Service.ps1
Configuration Demo_Service { Import-DSCResource -ModuleName MVADemo Node s2 { MVAService Bits { ServiceName = 'bits' Servicestatus = 'running' Ensure = 'Present' } } } Demo_Service -OutputPath C:\Scripts\DSC2\Mod3\Config
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod3/_M3_demo.ps1
_M3_demo.ps1
# 1. Push Deployment Copy-item -Path C:\Scripts\DSC2\mod3\MVADemo -Destination 'C:\Program Files\WindowsPowerShell\Modules\MVADemo' -Recurse -Force explorer 'C:\Program Files\WindowsPowerShell\Modules' Get-DscResource # 2. Pull server # Show module version in .psd1 ise C:\Scripts\dsc2\Mod3\MVADemo\MVADemo.p...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod7/WebServerConfig.ps1
WebServerConfig.ps1
Configuration WebServer { Node s3 { WindowsFeature web { Name = 'web-server' Ensure = 'Present' } } } webserver -outputpath c:\config
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod7/Config_NLB.ps1
Config_NLB.ps1
Configuration NLB { Node s3 { WindowsFeature NEwNLB { Name='NLB' Ensure = 'Present' } } } NLB -outputpath C:\DSCSMB
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod7/_M7-Demo.ps1
_M7-Demo.ps1
# 1. Composite resource structure ise C:\Scripts\DSC2\Mod7\LCM_Partial_Notes.ps1 ise C:\Scripts\DSC2\Mod7\LCM_Partial_Notes2.ps1 # Actual LCM Config ise C:\Scripts\DSC2\Mod7\LCM_Partial.ps1 # Set the LCM # Should remove configs Remove-DSCConfigurationDocuments Set-DscLocalConfigurationManager -Path C:\Scripts\...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod7/LCM_Partial_Notes2.ps1
LCM_Partial_Notes2.ps1
[DSCLocalConfigurationManager()] configuration SQLServerDSCSettings { Node localhost { Settings { ConfigurationModeFrequencyMins = 30 } ConfigurationRepositoryWeb OSConfigServer { ServerURL = "https://corp.contoso.com/OSConfigServe...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod7/LCM_Partial.ps1
LCM_Partial.ps1
[DscLocalConfigurationManager()] Configuration partialMeta { Node s3 { Settings { RefreshMode = "Pull" RefreshFrequencyMins = 30 ConfigurationModeFrequencyMins = 15 ConfigurationMode = "ApplyAndAutoCorrect" RebootNodeIfNeeded = $True Configu...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod7/LCM_Partial_Notes.ps1
LCM_Partial_Notes.ps1
[DscLocalConfigurationManager()] Configuration partialMeta { Settings { RefreshMode = "PULL" RefreshFrequencyMins = 30 ConfigurationModeFrequencyMins = 15 ConfigurationMode = "ApplyAndAutoCorrect" RebootNodeIfNeeded = $false ConfigurationId = "922A3987-...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod4/ClassStructureSimple.ps1
ClassStructureSimple.ps1
# From release notes enum Ensure { Absent Present } [DscResource()] class FileResource { [DscProperty(Key)] [string]$Path [DscProperty(Mandatory)] [Ensure] $Ensure [DscProperty(Mandatory)] [string] $SourcePath [DscProperty(NotConfigurable)] ...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod4/test.ps1
test.ps1
enum Ensure { Absent Present } [DscResource()] class ClassService { [DscProperty(Key)] [string]$serviceName [DscProperty(Mandatory)] [Ensure] $Ensure [DscProperty(Mandatory)] [string] $Servicestatus [ClassService] Get() { $serviceExists = Get-Serv...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod4/config_class.ps1
config_class.ps1
Configuration Demo_Class { Import-DSCResource -ModuleName MVAClassService Node dc { ClassService bits { Servicename = 'bits' Servicestatus = 'Running' Ensure = 'Present' } } } Demo_class
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod4/_M4-Demo.ps1
_M4-Demo.ps1
# 1. Custom resource structure using classes # use for example and explain ise C:\Scripts\DSC2\Mod4\ClassStructure.ps1 ise C:\Scripts\DSC2\Mod4\ClassStructureSimple.ps1 ise C:\Scripts\dsc2\Mod4\ClassManifeststructure.ps1 # 2. Create a class-defined custom resource ise C:\Scripts\DSC2\Mod4\Class\MVAClassSe...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod4/ClassStructure.ps1
ClassStructure.ps1
# From release notes enum Ensure { Absent Present } <# This resource manages the file in a specific path. [DscResource()] indicates the class is a DSC resource #> [DscResource()] class FileResource { <# This property is the fully qualified path to the file that is e...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod4/LCM_Class.ps1
LCM_Class.ps1
[DSCLocalConfigurationManager()] Configuration Debugmode { Node dc { Settings { AllowModuleOverwrite = $True ConfigurationMode = 'ApplyAndAutoCorrect' RefreshMode = 'Push' Debugmode = 'All' } } } DebugMode -OutputPath C:\scripts\dsc2\Mod4 # Send to computer...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod4/ClassManifeststructure.ps1
ClassManifeststructure.ps1
@{ # Script module or binary module file associated with this manifest. RootModule = 'MyDscResource.psm1' # Version number of this module. ModuleVersion = '1.0' # ID used to uniquely identify this module GUID = '81624038-5e71-40f8-8905-b1a87afe22d7' # Author of this module Author = 'User01' # Company...
PowerShellCorpus/PowerShellGallery/MVA_DSC_2015_DAY1/0.0.0.2/Scripts/DSC2/Mod1/_M1-Demo.ps1
_M1-Demo.ps1
# 1. DSC custom resource architecture overview # 3 Show the three files, then copy to bad location just to show # that the custom resource works. Then delete. ise C:\Scripts\DSC2\Mod1\MVAService\MVAService.schema.mof ise C:\Scripts\dsc2\mod1\MVAService\MVAService.psm1 ise C:\Scripts\DSC2\Mod1\MVAService\MVASer...