full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/New-Unattend.ps1
New-Unattend.ps1
function New-UnattendXml { <# .Synopsis Create a new Unattend.xml .DESCRIPTION This Command Creates a new Unattend.xml that skips any prompts, and sets the administrator password Has options for: Adding user accounts Auto logon a set n...
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/Invoke-CreateVmRunAndWait.ps1
Invoke-CreateVmRunAndWait.ps1
function Invoke-CreateVmRunAndWait { <# .Synopsis Create a temp vm with a random name and wait for it to stop .DESCRIPTION This Command quickly test changes to a VHD by creating a temporary VM and ataching it to the network. VM is deleted when it enters a stope...
PowerShellCorpus/PowerShellGallery/WindowsImageTools/1.0.7/Functions/Get-VhdPartitionStyle.ps1
Get-VhdPartitionStyle.ps1
Function Get-VhdPartitionStyle { <# .Synopsis Gets partition style of a VHD(x) .DESCRIPTION Returns the partition Style of the provided VHD(x) ei. GPT or MBR .EXAMPLE $partitionStyle = Get-VhdPartitionStyle -Vhd C:\win10.vhdx #> ...
PowerShellCorpus/PowerShellGallery/cRemoteDesktopServices/1.0/Examples/cRemoteDesktopServices/Configuration.ps1
Configuration.ps1
$DscResourcePath = Join-Path -Path $PSScriptRoot -ChildPath 'cRemoteDesktopServices' $ConfigurationFile = Join-Path -Path $PSScriptRoot -ChildPath 'Configuration.psm1' $ConfigDataFile = Join-Path -Path $PSScriptRoot -ChildPath 'Configuration.psd1' $CredentialFile = Join-Path -Path $PSScriptRoot -ChildPath 'C...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_WindowsOptionalFeatureSet_Enable.ps1
Sample_WindowsOptionalFeatureSet_Enable.ps1
<# .SYNOPSIS Enables the Windows optional features MicrosoftWindowsPowerShellV2 and Internet-Explorer-Optional-amd64 and outputs a log of the operations to a file at the path 'C:\LogPath\Log.txt'. #> Configuration WindowsOptionalFeatureSet_Enable { Import-DscResource -ModuleName ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_WindowsFeature.ps1
Sample_WindowsFeature.ps1
<# .SYNOPSIS Creates a custom configuration for installing or uninstalling a Windows role or feature. .PARAMETER Name The name of the role or feature to install or uninstall. Default is 'Telnet-Client'. .PARAMETER Ensure Specifies whether the role or feature should...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Archive_RemoveArchiveChecksum.ps1
Sample_Archive_RemoveArchiveChecksum.ps1
<# .SYNOPSIS Remove the expansion of the archive located at 'C:\ExampleArchivePath\Archive.zip' from the destination path 'C:\ExampleDestinationPath\Destination'. Since Validate is specified as $true and the Checksum parameter is specified as SHA-256, the resource will check i...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Environment_CreatePathVariable.ps1
Sample_Environment_CreatePathVariable.ps1
<# .SYNOPSIS Creates the environment variable 'TestPathEnvironmentVariable' and sets the value to 'TestValue' if it doesn't already exist or appends the value 'TestValue' to the existing path if it does already exist on the machine and within the process. #> Configuration Sample_Enviro...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_WindowsPackageCab.ps1
Sample_WindowsPackageCab.ps1
<# .SYNOPSIS Installs a package from the cab file with the specified name from the specified source path and outputs a log to the specified log path. .PARAMETER Name The name of the package to install. .PARAMETER SourcePath The path to the cab file to install the p...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_MsiPackage_InstallPackageFromFile.ps1
Sample_MsiPackage_InstallPackageFromFile.ps1
<# .SYNOPSIS Installs the MSI file with the product ID: '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' at the path: 'file://Examples/example.msi'. Note that the MSI file with the given product ID must already exist at the specified path. The product ID and path value in this file ar...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Script.ps1
Sample_Script.ps1
<# .SYNOPSIS Creates a file at the given file path with the specified content through the Script resource. .PARAMETER FilePath The path at which to create the file. .PARAMETER FileContent The content to set for the new file. #> Configuration ScriptExample { [CmdletBi...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_User_CreateUser.ps1
Sample_User_CreateUser.ps1
Configuration UserExample { param ( [System.Management.Automation.PSCredential] $PasswordCredential ) Import-DscResource -ModuleName PSDscResources User UserExample { Ensure = 'Present' # To ensure the user account does not exist, set Ensure to "Absent" ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_RegistryResource_AddKey.ps1
Sample_RegistryResource_AddKey.ps1
<# .SYNOPSIS Create a new registry key called MyNewKey as a subkey under the key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. #> Configuration Sample_RegistryResource_AddKey { Import-DscResource -ModuleName 'PSDscResources' Node localhost { Re...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_WindowsProcess_StopUnderUser.ps1
Sample_WindowsProcess_StopUnderUser.ps1
<# .SYNOPSIS Stops the gpresult process running under the given credential if it is running. Since the Arguments parameter isn't needed to stop the process, an empty string is passed in. .PARAMETER Credential Credential that the process is running under. #> Configuratio...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_WindowsOptionalFeatureSet_Disable.ps1
Sample_WindowsOptionalFeatureSet_Disable.ps1
<# .SYNOPSIS Disables the Windows optional features TelnetClient and LegacyComponents and removes all files associated with these features. #> Configuration WindowsOptionalFeatureSet_Disable { Import-DscResource -ModuleName 'PSDscResources' WindowsOptionalFeatureSet WindowsOptional...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_WindowsProcess_StartUnderUser.ps1
Sample_WindowsProcess_StartUnderUser.ps1
<# .SYNOPSIS Starts the gpresult process under the given credential which generates a log about the group policy. The path to the log is provided in 'Arguments'. .PARAMETER Credential Credential to start the process under. #> Configuration Sample_WindowsProcess_StartUnderUser {...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Group_SetMembers.ps1
Sample_Group_SetMembers.ps1
<# .SYNOPSIS If the group named GroupName1 does not exist, creates a group named GroupName1 and adds the users with the usernames Username1 and Username2 to the group. If the group named GroupName1 already exists, removes any users that do not have the usernames Userna...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Archive_RemoveArchiveNoValidation.ps1
Sample_Archive_RemoveArchiveNoValidation.ps1
<# .SYNOPSIS Removes the expansion of the archive located at 'C:\ExampleArchivePath\Archive.zip' from the destination path 'C:\ExampleDestinationPath\Destination'. The resource will only check if the expanded archive files exist at the destination. No validation is performed ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Group_RemoveMembers.ps1
Sample_Group_RemoveMembers.ps1
<# .SYNOPSIS If the group named GroupName1 does not exist, creates a group named GroupName1. If the group named GroupName1 already exists removes the users that have the usernames Username1 or Username2 from the group. #> Configuration Sample_Group_RemoveMembers { [Cmdl...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_WindowsOptionalFeature.ps1
Sample_WindowsOptionalFeature.ps1
<# .SYNOPSIS Enables the Windows optional feature with the specified name and outputs a log to the specified path. .PARAMETER FeatureName The name of the Windows optional feature to enable. .PARAMETER LogPath The path to the file to log the enable operation to. .NOTE...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_WindowsFeatureSet_Uninstall.ps1
Sample_WindowsFeatureSet_Uninstall.ps1
<# .SYNOPSIS Uninstalls the TelnetClient and RSAT-File-Services Windows features, including all their subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'. #> Configuration WindowsFeatureSetExample_Install { [CmdletBinding()] param () Import-DscResource -ModuleN...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_WindowsProcess_Start.ps1
Sample_WindowsProcess_Start.ps1
<# .SYNOPSIS Starts the gpresult process which generates a log about the group policy. The path to the log is provided in 'Arguments'. #> Configuration Sample_WindowsProcess_Start { param () Import-DSCResource -ModuleName 'PSDscResources' Node localhost { Windo...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_ServiceSet_StartServices.ps1
Sample_ServiceSet_StartServices.ps1
<# .SYNOPSIS Ensures that the DHCP Client and Windows Firewall services are running. #> Configuration ServiceSetStartExample { Import-DscResource -ModuleName 'PSDscResources' ServiceSet ServiceSet1 { Name = @( 'Dhcp', 'MpsSvc' ) Ensure = 'Present' State = ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Archive_ExpandArchiveNoValidationCredential.ps1
Sample_Archive_ExpandArchiveNoValidationCredential.ps1
<# .SYNOPSIS Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to the destination path 'C:\ExampleDestinationPath\Destination'. The added specification of a Credential here allows you to provide the credential of a user to provide the resource access to the ar...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Service_CreateService.ps1
Sample_Service_CreateService.ps1
<# .SYNOPSIS If the service with the name Service1 does not exist, creates the service with the name Service1 and the executable/binary path 'C:\FilePath\MyServiceExecutable.exe'. The new service will be started by default. If the service with the name Service1 already exists,...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Service_UpdateStartupTypeIgnoreState.ps1
Sample_Service_UpdateStartupTypeIgnoreState.ps1
<# .SYNOPSIS If the service with the name Service1 does not exist, this configuration would throw an error since the Path is not included here. If the service with the name Service1 already exists, sets the startup type of the service with the name Service1 to Manual and ignor...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_MsiPackage_InstallPackageFromHttp.ps1
Sample_MsiPackage_InstallPackageFromHttp.ps1
<# .SYNOPSIS Installs the MSI file with the product ID: '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' at the path: 'http://Examples/example.msi'. Note that the MSI file with the given product ID must already exist on the server. The product ID and path value in this file are provid...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_MsiPackage_UninstallPackageFromFile.ps1
Sample_MsiPackage_UninstallPackageFromFile.ps1
<# .SYNOPSIS Uninstalls the MSI file with the product ID: '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' at the path: 'file://Examples/example.msi'. Note that the MSI file with the given product ID must already exist at the specified path. The product ID and path value in this file ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_WindowsProcess_Stop.ps1
Sample_WindowsProcess_Stop.ps1
<# .SYNOPSIS Stops the gpresult process if it is running. Since the Arguments parameter isn't needed to stop the process, an empty string is passed in. #> Configuration Sample_WindowsProcess_Stop { param () Import-DSCResource -ModuleName 'PSDscResources' Node local...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_ProcessSet_Start.ps1
Sample_ProcessSet_Start.ps1
<# .SYNOPSIS Starts the processes with the executables at the file paths C:\Windows\cmd.exe and C:\TestPath\TestProcess.exe with no arguments. #> Configuration Sample_ProcessSet_Start { [CmdletBinding()] param () Import-DscResource -ModuleName 'PSDscResources' ProcessSe...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Archive_ExpandArchiveDefaultValidationAndForce.ps1
Sample_Archive_ExpandArchiveDefaultValidationAndForce.ps1
<# .SYNOPSIS Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to the destination path 'C:\ExampleDestinationPath\Destination'. Since Validate is specified as $true and the Checksum parameter is not provided, the resource will check if the last write time of t...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_RegistryResource_AddOrModifyValue.ps1
Sample_RegistryResource_AddOrModifyValue.ps1
<# .SYNOPSIS If the registry key value MyValue under the key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' does not exist, creates it with the Binary value 0. If the registry key value MyValue under the key 'HKLM:\SYSTEM\CurrentControlSet\Contro...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_RegistryResource_RemoveKey.ps1
Sample_RegistryResource_RemoveKey.ps1
<# .SYNOPSIS Removes the registry key called MyNewKey under the parent key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. #> Configuration Sample_RegistryResource_RemoveKey { Import-DscResource -ModuleName 'PSDscResources' Node localhost { Regis...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_ProcessSet_Stop.ps1
Sample_ProcessSet_Stop.ps1
<# .SYNOPSIS Stops the processes with the executables at the file paths C:\Windows\cmd.exe and C:\TestPath\TestProcess.exe with no arguments and logs any output to the path C:\OutputPath\Output.log. #> Configuration Sample_ProcessSet_Stop { [CmdletBinding()] param () ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Archive_ExpandArchiveNoValidation.ps1
Sample_Archive_ExpandArchiveNoValidation.ps1
<# .SYNOPSIS Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to the destination path 'C:\ExampleDestinationPath\Destination'. The resource will only check if the expanded archive files exist at the destination. No validation is performed on any existing fil...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_ServiceSet_BuiltInAccount.ps1
Sample_ServiceSet_BuiltInAccount.ps1
<# .SYNOPSIS Sets the Secure Socket Tunneling Protocol and DHCP Client services to run under the built-in account LocalService. #> Configuration ServiceSetBuiltInAccountExample { Import-DscResource -ModuleName 'PSDscResources' ServiceSet ServiceSet1 { Name =...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Environment_Remove.ps1
Sample_Environment_Remove.ps1
<# .SYNOPSIS Removes the environment variable 'TestEnvironmentVariable' from both the machine and the process. #> Configuration Sample_Environment_Remove { param () Import-DscResource -ModuleName 'PSDscResources' Node localhost { Environment RemoveEnvironmentV...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_User_Generic.ps1
Sample_User_Generic.ps1
param ( [Parameter(Mandatory)] [System.String] $ConfigurationName ) <# Create a custom configuration by passing in whatever values you need. $Password is the only param that is required since it must be a PSCredential object. If you want to create a user with minimal att...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Environment_CreateNonPathVariable.ps1
Sample_Environment_CreateNonPathVariable.ps1
<# .SYNOPSIS Creates the environment variable 'TestEnvironmentVariable' and sets the value to 'TestValue' both on the machine and within the process. #> Configuration Sample_Environment_CreateNonPathVariable { param () Import-DscResource -ModuleName 'PSDscResources' Node lo...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_GroupSet_AddMembers.ps1
Sample_GroupSet_AddMembers.ps1
<# .SYNOPSIS If the groups named GroupName1 and Administrators do not exist, creates the groups named GroupName1 and Administrators and adds the users with the usernames Username1 and Username2 to both groups. If the groups named GroupName1 and Administrators already e...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_WindowsFeatureSet_Install.ps1
Sample_WindowsFeatureSet_Install.ps1
<# .SYNOPSIS Installs the TelnetClient and RSAT-File-Services Windows features, including all their subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'. #> Configuration WindowsFeatureSetExample_Install { [CmdletBinding()] param () Import-DscResource -ModuleNam...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_MsiPackage_UnstallPackageFromHttps.ps1
Sample_MsiPackage_UnstallPackageFromHttps.ps1
<# .SYNOPSIS Uninstalls the MSI file with the product ID: '{DEADBEEF-80C6-41E6-A1B9-8BDB8A05027F}' at the path: 'https://Examples/example.msi'. Note that the MSI file with the given product ID must already exist on the server. The product ID and path value in this file are pro...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_RegistryResource_RemoveValue.ps1
Sample_RegistryResource_RemoveValue.ps1
<# .SYNOPSIS Removes the registry key value MyValue from the key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. #> Configuration Sample_RegistryResource_RemoveValue { Import-DscResource -ModuleName 'PSDscResources' Node localhost { Registry Regi...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Service_DeleteService.ps1
Sample_Service_DeleteService.ps1
<# .SYNOPSIS Stops and then removes the service with the name Service1. #> Configuration Sample_Service_DeleteService { [CmdletBinding()] param () Import-DscResource -ModuleName 'PSDscResources' Node localhost { Service ServiceResource1 { ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Examples/Sample_Archive_ExpandArchiveChecksumAndForce.ps1
Sample_Archive_ExpandArchiveChecksumAndForce.ps1
<# .SYNOPSIS Expands the archive located at 'C:\ExampleArchivePath\Archive.zip' to the destination path 'C:\ExampleDestinationPath\Destination'. Since Validate is specified as $true and the Checksum parameter is specified as SHA-256, the resource will check if the SHA-256 hash...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_RegistryResource.Tests.ps1
MSFT_RegistryResource.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment $script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent $script:testHelpersPath = Join-Path -Path $script:testFolderPath -ChildPath 'TestHelpers'...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_UserResource.Tests.ps1
MSFT_UserResource.Tests.ps1
# To run these tests, the currently logged on user must have rights to create a user [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param () $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testFolderPath = Split-Path -Path $PSS...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_WindowsProcess.Tests.ps1
MSFT_WindowsProcess.Tests.ps1
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param () $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:moduleRootPath = Split-Path -Path $PSScriptRoot -Parent $script:testHelpersPath = Join-Path -Path $script:moduleRootPath -C...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_GroupResource.Tests.ps1
MSFT_GroupResource.Tests.ps1
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param () $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent $script:testHelpersPath = Join-Path -Path $script:testFolderPath -C...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_WindowsFeature.Tests.ps1
MSFT_WindowsFeature.Tests.ps1
# Needed to create a fake credential [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param () $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent $script:testHelpersPath = Joi...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_WindowsOptionalFeature.Tests.ps1
MSFT_WindowsOptionalFeature.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent $script:testHelpersPath = Join-Path -Path $script:testFolderPath -ChildPath 'TestHelpers' Import-Module -Name (Join-Path -Path $script:testHelpersPath -ChildPath 'CommonTestHelper.psm1'...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/ResourceSetHelper.Tests.ps1
ResourceSetHelper.Tests.ps1
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param () $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testsFolderFilePath = Split-Path -Path $PSScriptRoot -Parent $script:moduleRootFilePath = Split-Path -Path $script:testsFol...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_EnvironmentResource.Tests.ps1
MSFT_EnvironmentResource.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment $script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent $script:testHelpersPath = Join-Path -Path $script:testFolderPath -ChildPath 'TestHelpers'...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_WindowsPackageCab.Tests.ps1
MSFT_WindowsPackageCab.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent $script:testHelpersPath = Join-Path -Path $script:testFolderPath -ChildPath 'TestHelpers' Import-Module -Name (Join-Path -Path $script:testHelpersPath -ChildPath 'CommonTestHelper.psm1'...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_MsiPackage.Tests.ps1
MSFT_MsiPackage.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' Describe 'MsiPackage Unit Tests' { BeforeAll { # Import CommonTestHelper $testsFolderFilePath = Split-Path $PSScriptRoot -Parent $testHelperFolderFilePath = Join-Path -Path $testsFolderFilePath -ChildPath 'TestHelpers' ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/CommonResourceHelper.Tests.ps1
CommonResourceHelper.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' Describe 'CommonResourceHelper Unit Tests' { BeforeAll { # Import the CommonResourceHelper module to test $testsFolderFilePath = Split-Path -Path $PSScriptRoot -Parent $moduleRootFilePath = Split-Path -Path $testsFolder...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_ScriptResource.Tests.ps1
MSFT_ScriptResource.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment $script:moduleRootPath = Split-Path -Path $PSScriptRoot -Parent $script:testHelpersPath = Join-Path -Path $script:moduleRootPath -ChildPath 'TestHelpers'...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_Archive.Tests.ps1
MSFT_Archive.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' Describe 'Archive Unit Tests' { BeforeAll { # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment $testsFolderFilePath = Split-Path $PSScriptRoot -Parent $testHelperFolderFilePa...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Unit/MSFT_ServiceResource.Tests.ps1
MSFT_ServiceResource.Tests.ps1
# Need to be able to create a password from plain text to create test credentials [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param () $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscRes...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/DscResource.Tests/Meta.Tests.ps1
Meta.Tests.ps1
<# .summary Test that describes code. .PARAMETER Force Used to force any installations to occur without confirming with the user. #> [CmdletBinding()] Param ( [Boolean]$Force = $false ) if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 { $PSScriptRoot = ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_RegistryResource_WithDataAndType.config.ps1
MSFT_RegistryResource_WithDataAndType.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Key, [ValidateSet('Present', 'Absent')] [String] ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_EnvironmentResource.Integration.Tests.ps1
MSFT_EnvironmentResource.Integration.Tests.ps1
# These tests must be run with elevated access $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment $script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent $script:testHelpersPath = Join-Path -Pa...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/ProcessSet.config.ps1
ProcessSet.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String[]] $ProcessPaths, [ValidateSet('Present', 'Absent')] [S...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/ProcessSet.Integration.Tests.ps1
ProcessSet.Integration.Tests.ps1
if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDscResources integration tests on PowerShell versions lower than 5.1' return } $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testFolderPath = Split-...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/ServiceSet_AllExceptBuiltInAccount.config.ps1
ServiceSet_AllExceptBuiltInAccount.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String[]] $Name, [ValidateSet('Present', 'Absent')] [ValidateN...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_GroupResource_MembersToIncludeExclude.config.ps1
MSFT_GroupResource_MembersToIncludeExclude.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $GroupName, [ValidateSet('Present', 'Absent')] [Valida...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_RegistryResource.Integration.Tests.ps1
MSFT_RegistryResource.Integration.Tests.ps1
<# WARNING: DO NOT RUN THESE TESTS ON A VALUABLE MACHINE! Running on a disposable VM or AppVeyor is strongly recommended. If these tests go awry, your machine's registry could be corrupted which will brick your machine! If this happens to you, it is fixable, but the fix is difficult and time-consumi...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_WindowsPackageCab.config.ps1
MSFT_WindowsPackageCab.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Name, [Parameter(Mandatory = $true)] [ValidateSet('Pr...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/WindowsFeatureSet.config.ps1
WindowsFeatureSet.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String[]] $WindowsFeatureNames, [ValidateSet('Present', 'Absent')] ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_EnvironmentResource.EndToEnd.Tests.ps1
MSFT_EnvironmentResource.EndToEnd.Tests.ps1
<# Please note that some of these tests depend on each other. They must be run in the order given - if one test fails, subsequent tests may also fail. #> if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDscResources inte...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_Archive_CredentialOnly.config.ps1
MSFT_Archive_CredentialOnly.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Path, [Parameter(Mandatory = $true)] [ValidateNotNull...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_Archive_ValidateAndChecksum.config.ps1
MSFT_Archive_ValidateAndChecksum.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Path, [Parameter(Mandatory = $true)] [ValidateNotNull...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_ServiceResource_CredentialOnly.config.ps1
MSFT_ServiceResource_CredentialOnly.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Name, [ValidateSet('Present', 'Absent')] [ValidateNot...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/GroupSet.Integration.Tests.ps1
GroupSet.Integration.Tests.ps1
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param () if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDscResources integration tests on PowerShell versions lower than 5.1' ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_WindowsFeature.Integration.Tests.ps1
MSFT_WindowsFeature.Integration.Tests.ps1
<# Integration tests for installing/uninstalling a Windows Feature. Currently Telnet-Client is set as the feature to test since it's fairly small and doesn't require a restart. ADRMS is set as the feature to test installing/uninstalling a feature with subfeatures, but this takes a good chunk of time...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_MsiPackage.EndToEnd.Tests.ps1
MSFT_MsiPackage.EndToEnd.Tests.ps1
<# Please note that some of these tests depend on each other. They must be run in the order given - if one test fails, subsequent tests may also fail. #> $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/WindowsOptionalFeatureSet.Integration.Tests.ps1
WindowsOptionalFeatureSet.Integration.Tests.ps1
if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDscResources integration tests on PowerShell versions lower than 5.1' return } $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testFolderPath = Split-Pa...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/ServiceSet_BuiltInAccountOnly.config.ps1
ServiceSet_BuiltInAccountOnly.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String[]] $Name, [ValidateSet('Present', 'Absent')] [ValidateN...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_GroupResource_Members.config.ps1
MSFT_GroupResource_Members.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $GroupName, [ValidateSet('Present', 'Absent')] [Valida...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_WindowsOptionalFeature.Integration.Tests.ps1
MSFT_WindowsOptionalFeature.Integration.Tests.ps1
if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDscResources integration tests on PowerShell versions lower than 5.1' return } $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testFolderPath = Split-Pa...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/GroupSet.config.ps1
GroupSet.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String[]] $GroupName, [ValidateSet('Present', 'Absent')] [Vali...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_ScriptResource_NoCredential.config.ps1
MSFT_ScriptResource_NoCredential.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $FilePath, [Parameter(Mandatory = $true)...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/WindowsOptionalFeatureSet.config.ps1
WindowsOptionalFeatureSet.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String[]] $WindowsOptionalFeatureNames, [ValidateSet('Present', 'Absent...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_WindowsProcess.Integration.Tests.ps1
MSFT_WindowsProcess.Integration.Tests.ps1
<# These tests should only be run in AppVeyor since the second half of the tests require the AppVeyor administrator account credential to run. Also please note that some of these tests depend on each other. They must be run in the order given - if one test fails, subsequent tests may also fai...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_ScriptResource_WithCredential.config.ps1
MSFT_ScriptResource_WithCredential.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $FilePath, [Parameter(Mandatory = $true)...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_GroupResource_NoMembers.config.ps1
MSFT_GroupResource_NoMembers.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $GroupName, [ValidateSet('Present', 'Absent')] [Valida...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_Archive_ValidateOnly.config.ps1
MSFT_Archive_ValidateOnly.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Path, [Parameter(Mandatory = $true)] [ValidateNotNull...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_MsiPackage.Integration.Tests.ps1
MSFT_MsiPackage.Integration.Tests.ps1
$errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDscResources integration tests on PowerShell versions lower than 5.1' return } $script:testsFolderFilePath = Spl...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/WindowsFeatureSet.Integration.Tests.ps1
WindowsFeatureSet.Integration.Tests.ps1
if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDscResources integration tests on PowerShell versions lower than 5.1' return } $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testFolderPath = Split-Pa...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_ServiceResource.Integration.Tests.ps1
MSFT_ServiceResource.Integration.Tests.ps1
<# These tests should only be run in AppVeyor since they currently require the AppVeyor administrator account credential to run. Also please note that these tests are currently dependent on each other. They must be run in the order given and if one test fails, subsequent tests will also fail....
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_WindowsPackageCab.Integration.Tests.ps1
MSFT_WindowsPackageCab.Integration.Tests.ps1
if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDscResources integration tests on PowerShell versions lower than 5.1' return } $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' $script:testFolderPath = Split-Pa...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_GroupResource.Integration.Tests.ps1
MSFT_GroupResource.Integration.Tests.ps1
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] param () $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) { Write-Warning -Message 'Cannot run PSDs...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_ServiceResource_AllExceptCredential.config.ps1
MSFT_ServiceResource_AllExceptCredential.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Name, [Parameter(Mandatory = $true)] [ValidateNotNull...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_MsiPackage_NoOptionalParameters.ps1
MSFT_MsiPackage_NoOptionalParameters.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $ProductId, [Parameter(Mandatory = $true)] [ValidateNo...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_WindowsProcess.config.ps1
MSFT_WindowsProcess.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Path, [Parameter(Mandatory = $true)] [AllowEmptyStrin...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_WindowsProcessWithCredential.config.ps1
MSFT_WindowsProcessWithCredential.config.ps1
param ( [Parameter(Mandatory = $true)] [String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Path, [Parameter(Mandatory = $true)] [AllowEmptyStrin...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_UserResource.config.ps1
MSFT_UserResource.config.ps1
# Integration Test Config Template Version 1.0.0 param ( [Parameter(Mandatory = $true)] [System.String] $ConfigurationName ) Configuration $ConfigurationName { param ( [System.String] $UserName = 'Test UserName', [System.String] ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_WindowsFeature.config.ps1
MSFT_WindowsFeature.config.ps1
param ( [Parameter(Mandatory)] [System.String] $ConfigurationName ) Configuration $ConfigurationName { param ( [Parameter(Mandatory = $true)] [System.String] $Name, [ValidateSet('Present', 'Absent')] [System.String] $Ensure ...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_RegistryResource.EndToEnd.Tests.ps1
MSFT_RegistryResource.EndToEnd.Tests.ps1
<# WARNING: DO NOT RUN THESE TESTS ON A VALUABLE MACHINE! Running on a disposable VM or AppVeyor is strongly recommended. If these tests go awry, your machine's registry could be corrupted which will brick your machine! If this happens to you, it is fixable, but the fix is difficult and time-consumi...
PowerShellCorpus/PowerShellGallery/PSDscResources/2.7.0.0/Tests/Integration/MSFT_UserResource.Integration.Tests.ps1
MSFT_UserResource.Integration.Tests.ps1
<# To run these tests, the currently logged on user must have rights to create a user. These integration tests cover creating a brand new user, updating values of a user that already exists, and deleting a user that exists. #> # Suppressing this rule since we need to create a plaintext password to ...