Skip to content

Instantly share code, notes, and snippets.

# Set execution policy
$ExecutionPolicy = Get-ExecutionPolicy
if ($ExecutionPolicy -ne "RemoteSigned") {
Set-ExecutionPolicy RemoteSigned -Force
}
# Cleanup logs, change number of days as you want
$days = 7
# Path of the logs to cleanup
# Attenzione prima di mettere in pausa gli aggiornamenti leggere qui:
# https://www.kyoceradocumentsolutions.com/asia/en/about-us/press/20210317_news.html
#
# Defect Patch (March 9 Released)
# Windows 10 Ver.20H2/2004 : KB5000802
# Windows 10 Ver.1909/1903 : KB5000808
# Windows 10 Ver.1803 : KB5000809
# Windows 10 Ver.1809 : KB5000822
#
# Microsoft had released the countermeasure Patch on 18thMarch.
@andreagx
andreagx / DisableTeamCreation.ps1
Last active September 3, 2020 09:14
DisableTeamCreation.ps1
#AzureAD preview module needed
#Before install AzureADPreview module, uninstall AzureAD Module: Uninstall-Module -Name AzureAD -Force
$groupname = "TEAMS-TeamCreation"
Connect-AzureAD
Get-AzureADGroup -SearchString $groupname
$Template = Get-AzureADDirectorySettingTemplate | where {$_.DisplayName -eq 'Group.Unified'}
$Setting = $Template.CreateDirectorySetting()
using System;
using System.Web.UI;
using Microsoft.SharePoint.Client;
using File = System.IO.File;
using Microsoft.SharePoint;
using System.Security;
using System.IO;
using System.Net;
using Microsoft.Extensions.DependencyModel;
Name DisplayName DisplayGroup Enabled Profile Direction Action
---- ----------- ------------ ------- ------- --------- ------
FileServer-ServerManager-SMB-TCP-In File Server Remote Management (SMB-In) File Server Remote Management True Any Inbound Allow
FileServer-ServerManager-DCOM-TCP-In File Server Remote Management (DCOM-In) File Server Remote Management True Any Inbound Allow
FileServer-ServerManager-Winmgmt-TCP-In File Server Remote Management (WMI-In)
#!/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
#Main function
Function GetWin8Key
{
$Hklm = 2147483650
$Target = $env:COMPUTERNAME
$regPath = "Software\Microsoft\Windows NT\CurrentVersion"
$DigitalID = "DigitalProductId"
$wmi = [WMIClass]"\\$Target\root\default:stdRegProv"
$msolcred = get-credential
connect-msolservice -credential $msolcred
@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
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
}
}