View zip_module_dsc_azure
#used for zipping up custom dsc resources prior to upload to Azure automation
#--------------------------------------------------------------------------------
#install the required xPSDesiredStateConfiguration module if you haven't already:
#Install-Module xPSDesiredStateConfiguration
#--------------------------------------------------------------------------------
#import the module
Import-Module xPSDesiredStateConfiguration
#--------------------------------------------------------------------------------
#create the module .zip for Azure uploading
Publish-ModuleToPullServer -Name xNetworking -OutputFolderPath C:\DSC\Uploads `
View dsc_custom_config
Configuration Demo4 {
Param ()
Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName xNetworking
node localhost {
#------------------------------------
WindowsFeature 'Telnet-Client' {
#DependsOn = "[WindowsFeature]Failover-Clustering"
Ensure = "Absent"
View Copy_RunLocal_withModule
#-------------------------------------------------------
#add a trusted source - only if required
#winrm s winrm/config/client '@{TrustedHosts="783721-hyp41,10.127.57.25"}'
#-------------------------------------------------------
#specify test device details and load up credentials
$s1 = "SERVER1"
$creds = Get-Credential -Message "Enter Credentials"
#-------------------------------------------------------
#create remote session with the appropriate options for your environment
$so = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck
View dsc_localhost
Configuration Demo3 {
Param ()
Import-DscResource -ModuleName PSDesiredStateConfiguration
node localhost {
#------------------------------------
WindowsFeature 'Telnet-Client' {
#DependsOn = "[WindowsFeature]Failover-Clustering"
Ensure = "Absent"
Name = "Telnet-Client"
View multi_node_dsc
Configuration Demo2 {
Param ()
Import-DscResource -ModuleName PSDesiredStateConfiguration
node $AllNodes.NodeName {
#------------------------------------
WindowsFeature 'Telnet-Client' {
#DependsOn = "[WindowsFeature]Failover-Clustering"
Ensure = "Absent"
Name = "Telnet-Client"
View dsc_push
#-------------------------------------------------------
#specify test device details and load up credentials
$s1 = "SERVER1"
$creds = Get-Credential -Message "Enter Credentials"
#-------------------------------------------------------
#create remote CIM session with the appropriate options for your environment
$sop = New-CimSessionOption –UseSSL -SkipCACheck -SkipCNCheck -SkipRevocationCheck
$cim = New-CimSession -ComputerName $s1 -Credential $creds -SessionOption $sop
#-------------------------------------------------------
#push the configuration
View 2_node_dsc
Configuration Demo1 {
Param ()
Import-DscResource -ModuleName PSDesiredStateConfiguration
node Server1 {
#------------------------------------
WindowsFeature 'Telnet-Client' {
#DependsOn = "[WindowsFeature]Failover-Clustering"
Ensure = "Absent"
Name = "Telnet-Client"
View measureSpeed
#-----------------------------------------------------
#1 - measure-command way
Measure-Command {Invoke-WebRequest `
-Uri 'https://gist.githubusercontent.com/techthoughts2/38ccacf3c7d2bf761c3783e131e589df/raw/0a5595f66935e3ebe3f2d69ea7be8b1639357327/profiles' `
-OutFile C:\rs-pkgs\test\profiles.ps1}
#-----------------------------------------------------
#2 - differencing datetime
$startMs = (Get-Date).Millisecond
Invoke-WebRequest `
-Uri 'https://gist.githubusercontent.com/techthoughts2/38ccacf3c7d2bf761c3783e131e589df/raw/0a5595f66935e3ebe3f2d69ea7be8b1639357327/profiles' `
View download_Web_File
#three ways to download a file using PowerShell
#example1: download a gist from github using webrequest
Invoke-WebRequest `
-Uri 'https://gist.githubusercontent.com/techthoughts2/38ccacf3c7d2bf761c3783e131e589df/raw/0a5595f66935e3ebe3f2d69ea7be8b1639357327/profiles' `
-OutFile C:\test\profiles.ps1
#example2: #download a gist from github using restmethod
Invoke-RestMethod `
-Uri 'https://gist.githubusercontent.com/techthoughts2/38ccacf3c7d2bf761c3783e131e589df/raw/0a5595f66935e3ebe3f2d69ea7be8b1639357327/profiles' `
View profiles
<#
.Synopsis
Evaluates all 6 PowerShell Profile locations and will indicate if they are present - and if so what they contain
.DESCRIPTION
Checks the location of all 6 PowerShell Profile to determine if there is a Profile file loaded there. If there is, the contents will be scanned so you can see what profile customizations are being loaded up.
.EXAMPLE
Test-PSProfiles
Checks all 6 PowerShell Profile locations and returns results
.EXAMPLE