This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$VMName = 'My VM' | |
(Get-CimInstance -Namespace Root\Virtualization\V2 -ClassName Msvm_VirtualSystemSettingData -Filter "ElementName = '$VMName'").BiosGUID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Find-Module -Tag DSC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install-Module -Name cFSRM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Save-Module -Name cFSRM -Path c:\temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configuration Sample_ciSCSIInitiator | |
{ | |
Param | |
( | |
[String] $NodeName = 'LocalHost' | |
) | |
Import-DscResource -Module ciSCSI | |
Node $NodeName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Describe 'MSFT_xFirewall\Get-TargetResource' { | |
Context 'Absent should return correctly' { | |
Mock Get-NetFirewallRule | |
It "Should return absent on firewall rule $($FirewallRule.Name)" { | |
$result = Get-TargetResource -Name 'FirewallRule' | |
$result.Name | Should Be 'FirewallRule' | |
$result.Ensure | Should Be 'Absent' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/PowerShell/DSCResources.git | |
Copy-Item .\DSCResources\Tests.Template\unit_template.ps1 .\ciSCSI\Tests\Unit\BMD_ciSCSIVirtualDisk.Tests.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the rule that will be used for testing | |
$FirewallRuleName = (Get-NetFirewallRule | ` | |
Sort-Object Name | ` | |
Where-Object {$_.DisplayGroup -ne $null} | ` | |
Select-Object -first 1).Name | |
$FirewallRule = Get-FirewallRule -Name $FirewallRuleName | |
$Properties = Get-FirewallRuleProperty -FirewallRule $FirewallRule | |
# Pull two rules to use testing that error is thrown when this occurs | |
$FirewallRules = (Get-NetFirewallRule | ` | |
Sort-Object Name | ` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create the Mock Objects that will be used for running tests | |
$TestVirtualDisk = [PSObject]@{ | |
Path = Join-Path -Path $ENV:Temp -ChildPath 'TestiSCSIVirtualDisk.vhdx' | |
Ensure = 'Present' | |
DiskType = 'Differencing' | |
SizeBytes = 100MB | |
Description = 'Unit Test iSCSI Virtual Disk' | |
BlockSizeBytes = 2MB | |
PhysicalSectorSizeBytes = 4096 | |
LogicalSectorSizeBytes = 512 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Describe "$($Global:DSCResourceName)\Get-TargetResource" { | |
Context 'Virtual Disk does not exist' { | |
Mock Get-iSCSIVirtualDisk | |
It 'should return absent Virtual Disk' { | |
$Result = Get-TargetResource ` | |
-Path $TestVirtualDisk.Path | |
$Result.Ensure | Should Be 'Absent' |
OlderNewer