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
function fixcursor | |
{ | |
[console]::CursorSize = 25 | |
} |
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
# This function is meant to simplify a check against a DSC Pull Server. If you do not use the default service URL, you will need to adjust accordingly. | |
function Verify-DSCPullServer ($fqdn) { | |
([xml](invoke-webrequest "https://$($fqdn):8080/psdscpullserver.svc" | % Content)).service.workspace.collection.href | |
} | |
Verify-DSCPullServer 'INSERT SERVER FQDN' |
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
# https://gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-0fe23a8f | |
# Update line 3044 | |
# In version 6.3, the evaluator was comparing strings to integers. | |
# Replacing this line will use version objects to check the version of Windows and integers for the build number. | |
$isWin8 = (((new-object Version $os.Version) -ge (new-object Version 6.2)) -and ([uint32]$os.BuildNumber -ge $lowestSupportedBuild)) |
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
$LastStatus = (Get-DscConfigurationStatus).StartDate | |
$Frequency = (Get-DscLocalConfigurationManager).ConfigurationModeFrequencyMins | |
while ( (Get-Date) -lt ($LastStatus.AddMinutes($Frequency)) ) | |
{ | |
Write-Host ((Get-Date) - ($LastStatus.AddMinutes($Frequency))) | |
} |
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
# This script is intended to configure Hyper-V on a Windows 10 machine where virtual disks are already present. | |
Configuration testbox | |
{ | |
Import-DscResource -module xHyper-V, xDismFeature | |
Node localhost | |
{ | |
xDismFeature HyperV | |
{ | |
Ensure = 'Present' |
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
function Get-WSManTrust { | |
(Get-Item -Path WSMan:\localhost\Client\TrustedHosts | % Value).split(',') | |
} | |
function New-WSManTrust { | |
param( | |
[string]$hostname | |
) | |
Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value $hostname -Concatenate -Force | |
} |
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
function copy-foldertovirtualmachine { | |
param( | |
[parameter (mandatory = $true, valuefrompipeline = $true)] | |
[string]$VMName, | |
[string]$Folder = '.\' | |
) | |
foreach ($File in (Get-ChildItem $Folder -recurse | ? Mode -ne 'd-----')){ | |
Copy-VMFile -VM (Get-VM $VMName) -SourcePath $file.fullname -DestinationPath $file.fullname -FileSource Host -CreateFullPath -Force} | |
} |
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
function PoshMon { | |
param ( | |
[Parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$True)] | |
[string]$command, | |
[Int32]$seconds = 300 | |
) | |
Begin { | |
[System.Console]::Clear() | |
[console]::CursorSize = 1 | |
$now = Get-Date |
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
function Get-AvailableMemory { | |
$Mem = '' | Select AvailableMemory | |
$Mem.AvailableMemory = Get-Counter '\Memory\Available MBytes' | % CounterSamples | % CookedValue | |
return $Mem | |
} | |
New-Alias Mem Get-AvailableMemory -Scope Global |
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-azpolicydefinition | | |
? {$_.Properties.PolicyType -eq "BuiltIn" -AND $_.Properties.DisplayName -like "*baseline*"} | | |
select policyDefinitionId -ExpandProperty Properties | | |
select policyDefinitionId, DisplayName | | |
fl |