Skip to content

Instantly share code, notes, and snippets.

View PlagueHO's full-sized avatar
😼
Working on Game Master Copilot using Semantic Kernel, Azure OpenAI and Blazor 8

Daniel Scott-Raynsford PlagueHO

😼
Working on Game Master Copilot using Semantic Kernel, Azure OpenAI and Blazor 8
View GitHub Profile
@PlagueHO
PlagueHO / Get-HyperVBIOSGUID.ps1
Last active November 29, 2015 22:26
Get the BIOS GUID of a Hyper-V VM
$VMName = 'My VM'
(Get-CimInstance -Namespace Root\Virtualization\V2 -ClassName Msvm_VirtualSystemSettingData -Filter "ElementName = '$VMName'").BiosGUID
@PlagueHO
PlagueHO / FindDSCResources.ps1
Created December 14, 2015 05:03
Search PowerShell Gallery for Modules with the tag DSC
Find-Module -Tag DSC
@PlagueHO
PlagueHO / InstallcFSRMModule.ps1
Created December 14, 2015 05:08
Install cFSRM DSC Resource Module
Install-Module -Name cFSRM
@PlagueHO
PlagueHO / SavecFSRMModule.ps1
Last active December 14, 2015 20:55
Save cFSRM DSC Module
Save-Module -Name cFSRM -Path c:\temp
@PlagueHO
PlagueHO / Sample_ciSCSITarget.ps1
Created December 16, 2015 22:13
Example DSC Configuration of an iSCSI Target
configuration Sample_ciSCSIInitiator
{
Param
(
[String] $NodeName = 'LocalHost'
)
Import-DscResource -Module ciSCSI
Node $NodeName
@PlagueHO
PlagueHO / Example_DSCResourceUnitTest.ps1
Created December 17, 2015 21:37
A Unit test of the xFirewall DSC Resource in the xNetworking module
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'
}
}
@PlagueHO
PlagueHO / Example_PullFirewallRulesForDSCUnitTests.ps1
Created December 18, 2015 01:41
Pull Firewall Rules for DSC Unit Tests
# 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 | `
@PlagueHO
PlagueHO / Example_DSCLocalizedData.psd1
Last active December 19, 2015 01:36
Example DSC Localized Data section
data LocalizedData
{
# culture="en-US"
ConvertFrom-StringData -StringData @'
GettingiSCSIVirtualDiskMessage=Getting iSCSI Virtual Disk "{0}".
iSCSIVirtualDiskExistsMessage=iSCSI Virtual Disk "{0}" exists.
iSCSIVirtualDiskDoesNotExistMessage=iSCSI Virtual Disk "{0}" does not exist.
SettingiSCSIVirtualDiskMessage=Setting iSCSI Virtual Disk "{0}".
EnsureiSCSIVirtualDiskExistsMessage=Ensuring iSCSI Virtual Disk "{0}" exists.
EnsureiSCSIVirtualDiskDoesNotExistMessage=Ensuring iSCSI Virtual Disk "{0}" does not exist.
@PlagueHO
PlagueHO / Example_DSCImportLocalizedData.ps1
Created December 19, 2015 01:42
Import LocalizedData in DSC Resource
Import-LocalizedData -BindingVariable LocalizedData -Filename BMD_cMyNewResource.psd1
Write-Verbose -Message ($LocalizedData.iSCSIVirtualDiskExistsMessage -f $Path)