Category: Codes

PowerShell: Windows Systems Inventory

<# Systems-Inventory.ps1 Version: 0.04 Purpose: to generate a report with information about servers on the…

PowerShell: Windows System Discovery – Deprecated

<# windows-localhost-discovery-v0.11.ps1 Purpose: scan the local or remote Windows machine for general system resources, security…

PowerShell: Creating Clustered File Shares

# Define Destination Mount Points and UNC Paths $arr=@{} $arr["from"] = @{}; $arr["to"] = @{}…

PowerShell: SMB Shares Migration

$object='\\fileserver\sharename' $identity='domain\account' $permissions='Full' function importNtfsSecurity{ try{ set-executionpolicy unrestricted -force # Include the required NTFSSecurity library…

PowerShell: Purge OneDrive

# purgeOneDrive_v0.0.1.ps1function purgeOneDrive{ write-host "Halting OneDrive and explorer processes..." taskkill.exe /F /IM "OneDrive.exe" taskkill.exe /F…

PowerShell: Creating Scheduled Tasks on Remote Servers

This script is deprecated. Here is a better iteration. # scheduledTasksRemote_V0.0.2.ps1# Purpose: to add a…

PowerShell: Creating VSS Snapshots on Microsoft File Server Clusters

<# VSS-Snapshots-on-Microsoft-File-Server-Clusters_v0.0.1.ps1 # Author: KimConnect.com Functions: 1. Create snapshots of all volumes on a file…

PowerShell: Create New Hybrid On Prem Active Directory User with Office 365 Integration

# createNewHybridUser_v0.0.1.ps1# .Description: this script automates the creation of a user account in a hybrid…

PowerShell: Checking Computer Type

# Determine what type of Windows machine (client or server)switch ((Get-CimInstance -ClassName Win32_OperatingSystem).ProductType){1 {'client'} #…

PowerShell: Adding Active Directory Module

Windows environments often are controlled by Active Directory; hence, it is useful to include this…

PowerShell: Obtain Domain Admin Credential

function obtainDomainAdminCredentials{ # Legacy domain binding function function isValidCred($u,$p){ # Get current domain using logged-on…

VSS Error: Snapshots were found, but they were outside of your allowed context

Error: PS C:\Windows\system32> vssadmin delete shadows /for=c: /allvssadmin 1.1 - Volume Shadow Copy Service administrative…

PowerShell: Automating Microsoft Failover Cluster Maintenance – FileServer, SQL AlwaysOn, Hyper-V Guest VMs, Disks Operations

##################################################################################################### # MsClusterMaintenance_v0.0.2.ps1 # Author: KimConnect.com # License: GPLv3 # Description: this program automates the…

PowerShell: Set Application CPU Affinity on Remote and Local Computers

# setProcessNameToCpuNumber.ps1$computerName =$env:computername$processname="Chrome";function getProcessors{ param( $computerName=$env:computername ) [int]$processors = 0; $cpuObject = Get-WmiObject -computername $computerName…

PowerShell: File Copy Script using EmCopy & VSS (Legacy)

The script below is for informational purposes. Here is a better version <#.Description FileCopyScript_v1.1.8.ps1 Note: this…

PowerShell: Add Windows TrustedHosts Remotely

<# AddTrustedHostsRemote.ps1Solves this problem:enter-pssession : Connecting to remote server REMOTESHERVER failed with the following error…

PowerShell: Optimize RAM on Remote Computers

# simultaneousExec_v0.01.ps1# Requirement: must run as Administrator$computerNames="SHERER1","SHERER2"function installEmptyStandbyList{ $emptyStandbyListAvailable=(Get-Command EmptyStandbyList.exe -ErrorAction SilentlyContinue); if(!($emptyStandbyListAvailable)){ # Set…

PowerShell: Function to Execute Function Remotely

Function this function that - this quick snippet is to invoke those func things remotely...…

PowerShell: Synchronize Directories with File Signature Comparisons

<# fileCompare_v0.01.ps1- Requires that the source and destination paths are hosted on Windows machines, not…

PowerShell: Add Quorum to Clusters

# SetClusterQuorum.ps1$clustersAndQuorums=@();$clustersAndQuorums+=[PSCustomObject]@{ClusterName='CLUSTER1';Quorum='\\FILESHERVER007\CLUSTER1$'};$clustersAndQuorums+=[PSCustomObject]@{ClusterName='CLUSTER2';Quorum='\\FILESHERVER007\CLUSTER2$'};function getViableNode{ param($nodes) foreach ($node in $nodes){ $bingo=Test-NetConnection $node -InformationLevel Quiet; if($bingo){return $node} }}…