Skip to content

Instantly share code, notes, and snippets.

View mczerniawski's full-sized avatar

mczerniawski mczerniawski

View GitHub Profile
$HyperVHosts = @('NodeHV1','NodeHV2')
$IPAddress = '10.2.3'
$SelectObjectFilter = @(
@{name = 'VMName'; e={$PSItem.VMName}},
@{name = 'ComputerName';e={$PSItem.ComputerName}},
@{name = 'IPAddress';e={$PSItem.IPAddresses}},
@{name = 'SwitchName';e={$PSItem.SwitchName}},
@{name = 'MacAddress';e={$Psitem.MacAddress}}
)
function Get-ClusterNodeMemory {
<#
.Synopsis
Get the available memory of each node in a cluster.
.DESCRIPTION
Get the available memory of each node in a cluster particularly for Hyper-V.
.PARAMETER Cluster
Provide Cluster Name. Will accept an array of cluter names
____ _ _
| _ \| | __ _ ___| |_ ___ _ __
| |_) | |/ _` / __| __/ _ \ '__|
| __/| | (_| \__ \ || __/ |
|_| |_|\__,_|___/\__\___|_|
v1.1.3
==================================================
Author (Mateusz Czerniawski):
Name of your module: TestModule1
Version Number (0.0.1):
$PlasterTemplatePath = 'Path to PPoshModule template folder' #Path to where you've downloaded this module
$DestinationPath = 'C:\AdminTools\ModuleTest1' #Path to your git repository folder
Invoke-Plaster -TemplatePath $PlasterTemplatePath -DestinationPath $DestinationPath
function Get-ClusterCSVUsage {
<#
.SYNOPSIS
Retrieves CSV detailed information from Cluster
.DESCRIPTION
Will connect to cluster using Invoke-Command (to allow use of optional Credential Parameter) and retrieve detailed information on any CSV found
.PARAMETER Cluster
Cluster Name or array of Cluster Names
Function Get-PrivilegedGroupChanges {
<#
.SYNOPSIS
Will check for changes in Privileged Groups using Replication Metadata
.DESCRIPTION
Will return all members of Groups with 'AdminCount=1' that changed within last $Hours. Can target other domains - require ComputerName and Credential parameter then.
.PARAMETER ComputerName
Domain Controller of another domain. Provide FQDN name
function Get-PrivilegedUsers {
<#
.SYNOPSIS
Returns all users belonging to Privileged Groups in Domain
.DESCRIPTION
Will return all members of Groups with 'AdminCount=1'. Can target other domains - require ComputerName and Credential parameter then.
.PARAMETER ComputerName
Domain Controller of another domain. Provide FQDN name
$CloudFlareAPIToken = 'YOURTOKENGOESHERE'
$CloudFlareEmailAddress = 'YOUREMAIL AKA YOUR LOGIN'
$CloudFlareBaseUrl = 'https://api.cloudflare.com/client/v4/zones'
$CloudFlareHeaders = @{
'X-Auth-Key' = $CloudFlareAPIToken
'X-Auth-Email' = $CloudFlareEmailAddress
}
function Get-CloudFlareFullZonesConfiguration {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, HelpMessage = 'Provide your CloudFlare API token',
ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[ValidateNotNullOrEmpty()]
[string]
$CloudFlareAPIToken,
$ComputerName = 'nbmczerniawski2'
$DNComputer = Get-ADComputer $computerName | Select-Object -ExpandProperty DistinguishedName
$obj = get-adobject -Filter {objectclass -eq 'msFVE-RecoveryInformation'} -SearchBase $DNComputer -Properties 'msFVE-RecoveryPassword' | Select-Object Name,msFVE-RecoveryPassword
[Ordered]@{
ComputerName = $ComputerName
RecoveryPassword = $obj.'msFVE-RecoveryPassword'
Date = Get-Date -Date ($obj.Name ).Split('{')[0]
KeyID = (($obj.Name ).Split('{')[1]).TrimEnd('}')
}