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
$FileToCopyPath = '\\MyFileSrv01\MyShare\MyFile.doc' | |
$FileToCheckPath = 'C:\Program Files\My Program\MyFile.doc' | |
If (!(Test-Path $FileToCheckPath)) { | |
Return 'False' | |
Break | |
} else { | |
$FileToCopyMD5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider | |
$FileToCopyHash = [System.BitConverter]::ToString($FileToCopyMD5.ComputeHash([System.IO.File]::ReadAllBytes($FileToCopyPath))) |
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
New-ISESnippet -Title 'Match array values against string' ` | |
-Description 'Check to see if any value of an array is in a string.' ` | |
-Text 'if ($Array | ? { $StringToLookIn -match $_ }) {' |
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
$ClusteredVMs = Get-ClusterResource | ? ResourceType -eq 'Virtual Machine' | Select Name | |
$VMs = Get-VM -ComputerName node01,node02 | Select Name | |
Compare-Object $VMs $ClusteredVMs -IncludeEqual |
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 Start-SpeedTest { | |
param( | |
# How long (in minutes) to run the speedtest for | |
[Parameter( | |
Mandatory = $False | |
)] | |
[int]$Duration = 30, | |
# The interval (in minutes) to run the test |
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-ADUser -Filter * ` | |
-SearchBase (Get-ADOrganizationalUnit -Filter 'Name -like "*MY OU*"') ` | |
-Properties ProxyAddresses,Mail | | |
ForEach-Object { | |
if (!($_.Mail)) { | |
Write-Host ($_.SamAccountName + ' - No mail attribute defined') -ForegroundColor Red | |
} else { | |
$NewProxyAddress = ('SMTP:' + $_.Mail) |
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 Remove-LongFolderPath { | |
[CmdletBinding()] | |
Param( | |
[Parameter( | |
Mandatory = $True | |
)] | |
[string]$Path, | |
[switch]$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
# | |
# check-iscsi.ps1 | |
# | |
# DESCRIPTION: | |
# This plugin checks that each ISCSI IQN passed to it is currently connected. | |
# | |
# OUTPUT: | |
# plain text | |
# | |
# PLATFORMS: |
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
# file.managed and cmd.run echo output | |
{"client": {"services": {"critical": "ReportServer$OLIVER,MSSQL$OLIVER,SoftlinkOliver"}}} |
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
{%- macro recurse_dict(data) -%} | |
{%- set topdict = {} -%} | |
{%- for k,v in data.iteritems() %} | |
{%- if v is mapping -%} | |
{%- do topdict.update({ k: recurse_dict(v) }) -%} | |
{%- elif v is iterable and v is not string -%} | |
{%- set list_as_str = v | join(',') -%} | |
{%- do topdict.update({ k: list_as_str }) -%} | |
{%- else -%} | |
{%- do topdict.update({ k: v }) -%} |
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
#! /usr/bin/env ruby | |
# | |
# check-windows-port-listening.rb | |
# | |
# DESCRIPTION: | |
# Check to see which ports are listening, using netstat. | |
# First draft. | |
# | |
# OUTPUT: | |
# plain text |
OlderNewer