Skip to content

Instantly share code, notes, and snippets.

<#
.SYNOPSIS
Backs up Cisco UCS Manager as a scheduled task
.DESCRIPTION
All available UCS Manager backup types will be taken and compressed (ZIP) then stored in the specified location
.OUTPUTS
None. Progress is displayed via Write-Host when running the script manually, but there is no output returned.
.EXAMPLE
.\Backup-CiscoUcs.ps1 -PsSessionXml 'C:\PsSessionInfo.xml' -DecryptionKey 'PlaintextPrivateKeyGoesHere' -BackupLocation 'C:\Backups'
.NOTES
param(
[String]$DomainDN = 'dc=ad,dc=contoso,dc=com',
[String]$LocalBackupPath = 'C:\Windows\System32\dhcp\backup',
[String]$RemoteBackupPath = '\\fileserver\share\Backups\DHCP',
[Int32]$BackupDaysToRetain = 30
)
begin{
@IMJLA
IMJLA / GadgetExchange.psm1
Last active May 8, 2018 21:36
PowerShell Module to Automatically Discover and Connect to Exchange
Function ConvertTo-ExchangeRole{
<#
.SYNOPSIS
Convert the msExchCurrentServerRoles AD attribute into the Exchange Roles it represents
.DESCRIPTION
Performs a bitwise And comparison against a provided integer and the keys from a hard-coded dictionary
Dictionary based on a table from a TechNet article
https://technet.microsoft.com/en-us/library/bb123496(EXCHG.80).aspx
.PARAMETER Roles
Integer representing the Exchange roles held by the server. Matches the msExchCurrentServerRoles AD attribute.
@IMJLA
IMJLA / Copy-GroupMembers.ps1
Last active January 6, 2020 03:53
PowerShell script to add all members of a source group to a target group in Active Directory
<#
.SYNOPSIS
Add all members of a source group to a target group in Active Directory.
.DESCRIPTION
Members of the source group will be added to the target group if not already members
Existing members of the target group will not be modified.
.OUTPUTS
Results are written to the console.
.EXAMPLE
.\Copy-GroupMembers.ps1
@IMJLA
IMJLA / Copy-GroupMemberships.ps1
Last active October 26, 2017 19:08
PowerShell script to copy group memberships from a source user to a target user in Active Directory
<#
.SYNOPSIS
Copy group memberships from a source user to a target user in Active Directory
.DESCRIPTION
The target user will be added to all groups the source user is a member of.
Existing group memberships of the target user will NOT be removed.
.PARAMETER SourceUser
The source user whose memberships are to be copied
.PARAMETER TargetUser
The target user to be added to the groups