Skip to content

Instantly share code, notes, and snippets.

@andreagx
andreagx / WSB_report.ps1
Last active January 3, 2016 19:19
The script send by email a report with Windows Server Backup activity and the target status.If backup fail or target space is under 10% the row in the table becomes with a red background.Location: C:\Users\Public\BackupLog.htm.Schedule script i.e. 2 hours before backup start time.
<#
andreagx.blogspot.com
The script send by email a report with Windows Server Backup activity and the target status
If backup fail or target space is under 10% the row in the table becomes with a red background
Location: C:\Users\Public\BackupLog.htm
Schedule script i.e. 2 hours before backup start time
http://andreagx.blogspot.it/2014/01/windows-server-backup-inviare-un-report.html
#>
@andreagx
andreagx / gist:8580244
Created January 23, 2014 15:17
WSUS_Cleaner.ps1
[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
$cleanupScope = new-object Microsoft.UpdateServices.Administration.CleanupScope;
$cleanupScope.DeclineSupersededUpdates = $true
$cleanupScope.DeclineExpiredUpdates = $true
$cleanupScope.CleanupObsoleteUpdates = $true
$cleanupScope.CompressUpdates = $true
#$cleanupScope.CleanupObsoleteComputers = $true
$cleanupScope.CleanupUnneededContentFiles = $true
$cleanupManager = $wsus.GetCleanupManager();
###########################################################################”
# AUTHOR: Jan Egil Ring
# Modifications by Darren Kattan
#
# COMMENT: Script to create an Outlook signature based on user information from Active Directory.
# Adjust the variables in the “Custom variables”-section
# Create an Outlook-signature from Microsoft Word (logo, fonts etc) and copy this signature to \\domain\NETLOGON\sig_files\$CompanyName\$CompanyName.docx
# This script supports the following keywords:
# DisplayName
# Title
# OWA Signature import by Andrea Gallazzi www.andreagallazzi.com
#var old is text to remove
$old = 'src=".+?_file/image001.gif"'
#var $new = the text you want to replace
$new = 'src="http://www.mypublicwebsite.com/image001.gif"'
#change the Get-ChildItem to a folder or your choice
Get-ChildItem C:\Signatures\*.htm | Where {$_ -IS [IO.FileInfo]} |
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add(
"Connect to Exchange",
{
$s = New-PSSession -ConfigurationName Microsoft.Exchange `
-ConnectionUri http://your_server_fqdn_name/PowerShell/ `
-Authentication Kerberos
Import-PSSession $s
},
"Control+Alt+G"
function TransferReceiveConnectors {
$SourceServer = "Exchange_Source"
$DestinationServer = "Exchange_Dest"
$SourceReceiveConnector = ForEach-Object {Get-ReceiveConnector -Server $SourceServer}
ForEach ($Connector in $SourceReceiveConnector)
{
New-ReceiveConnector -Name $Connector.Name -Server $DestinationServer -Bindings $Connector.Bindings -AuthMechanism $Connector.AuthMechanism -PermissionGroups $Connector.PermissionGroups -RemoteIPRanges $Connector.RemoteIPRanges
}
}
@andreagx
andreagx / WindowsBackupEmailReportv2.ps1
Last active July 7, 2021 08:21
WindowsBackupEmailReportv2
<#
.NOTES
===========================================================================
Created with: Windows Powershell ISE
Created on: 22/10/2015 03:16 V2.0.1
Created by: Andrea Gallazzi
Filename: backup_email_V2.ps1
===========================================================================
.DESCRIPTION
$msolcred = get-credential
connect-msolservice -credential $msolcred
#Main function
Function GetWin8Key
{
$Hklm = 2147483650
$Target = $env:COMPUTERNAME
$regPath = "Software\Microsoft\Windows NT\CurrentVersion"
$DigitalID = "DigitalProductId"
$wmi = [WMIClass]"\\$Target\root\default:stdRegProv"
#!/bin/bash
#Purpose = Backup of Important Data
#Created on 17-1-2012
#Author = Andrea Gallazzi
#Version 1.0
#START
#TIME=`date +%b-%d-%y` # This Command will add date in Backup File Name if needed
#FILENAME=backupxyz.tar.gz # Backup file name format if needed