Archivi tag: script

Schedulare uno script Powershell EMS 2010 usando lo schedulatore di Windows

Step per schedulare uno script che utilizza la Exchange Management Shell (EMS) 2010.

  1. Dallo schedulatore, “Create Basic Task…
  2. Schedulare lo script nella sezione “Trigger
  3. Nella sezione “Action“, selezionare “Start a program
    • In Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    • In Add arguments (optional): -WindowsStyle Hidden -command “. ‘C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1’; Connect-ExchangeServer -auto; c:\script\myscript.ps1”
       WindowsStyle Hidden: per non far apparire finestre a monitor
       c:\script\myscript.ps1: script da far girare

Create Basic Task Wizard

Script ruoli FSMO e GlobalCatalogs

Script Powershell per individuare i ruoli FSMO ed i server GC

#Importazione module AD se non presente
if(!(get-module activedirectory)) {Import-Module activedirectory -Cmdlet Get-ADForest, Get-ADDomain }

#Recupero nome dominio e foresta
$DomainName = Get-ADDomain
$ForestName = Get-ADForest
Function FSMO_GL {
$obj = New-Object PSObject -Property @{
Server_PDC = $DomainName.PDCEmulator
Server_RID = $DomainName.RIDMaster
Server_Infrastructure = $DomainName.InfrastructureMaster
Server_Schema = $ForestName.SchemaMaster
Server_DomainNaming = $ForestName.DomainNamingMaster
Server_GlobalCatalogs = $ForestName.GlobalCatalogs
}
$obj

}
FSMO_GL

DISCLAIMER: Nessuna garanzia per lo script. Lo usate a vostro rischio. Lo scrivente non è responsabile di qualunque danno possa eventualmente derivarne 😉

Script Reset Windows Update Agent

Fonte: http://gallery.technet.microsoft.com/scriptcenter/Dos-Command-Line-Batch-to-fb07b159

@echo off 
cls 

REM ================================================================================== 
REM DESCRIPTION    : This script resets all of Windows Update Agent settings. 
REM AUTHOR         : Luca Fabbri 
REM VERSION HISTORY: 1.2 - Stop SMS Host Agent (SCCM Client) Service added 
REM                  1.0 - Start 
REM ================================================================================== 

@echo 1. Stopping Automatic Updates, BITS and SMS Host Agent Services... 
net stop wuauserv 
net stop bits  
net stop ccmexec 

@echo 2. Deleting AU cache folder and log file... 
del /f /q %SystemRoot%WindowsUpdate.log 
del /f /s /q %SystemRoot%SoftwareDistribution*.* 
REM @echo 2. Renaming AU cache folder and log file... 
REM ren %SystemRoot%WindowsUpdate.log %SystemRoot%WindowsUpdate.bak 
REM ren %SystemRoot%SoftwareDistribution %SystemRoot%SoftwareDistribution.bak 

@echo 3. Re-registering DLL files... 
%SystemRoot%system32regsvr32.exe /s %SystemRoot%system32atl.dll  
%SystemRoot%system32regsvr32.exe /s %SystemRoot%system32jscript.dll  
%SystemRoot%system32regsvr32.exe /s %SystemRoot%system32msxml3.dll  
%SystemRoot%system32regsvr32.exe /s %SystemRoot%system32softpub.dll  
%SystemRoot%system32regsvr32.exe /s %SystemRoot%system32wuapi.dll  
%SystemRoot%system32regsvr32.exe /s %SystemRoot%system32wuaueng.dll  
%SystemRoot%system32regsvr32.exe /s %SystemRoot%system32wuaueng1.dll  
%SystemRoot%system32regsvr32.exe /s %SystemRoot%system32wucltui.dll  
%SystemRoot%system32regsvr32.exe /s %SystemRoot%system32wups.dll  
%SystemRoot%system32regsvr32.exe /s %SystemRoot%system32wups2.dll  
%SystemRoot%system32regsvr32.exe /s %SystemRoot%system32wuweb.dll 

@echo 4. Removing WSUS Client Id... 
REG DELETE "HKLMSOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdate" /v AccountDomainSid /f 
REG DELETE "HKLMSOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdate" /v PingID /f 
REG DELETE "HKLMSOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdate" /v SusClientId /f 

@echo 5. Starting Automatic Updates, BITS and SMS Host Agent Services... 
net start ccmexec 
net start bits 
net start wuauserv 

@echo 6. Forcing AU discovery... 
wuauclt /resetauthorization /detectnow

Enterprise Vault – Muovere DB SQL su un nuovo server

Qua la procedura per spostare i DB di SQL di EV su un nuovo server:

http://www.symantec.com/business/support/index?page=content&id=TECH35744

Per identificare i DB inerenti gli indici si può utilizzare il seguente script:

USE EnterpriseVaultDirectory

SELECT

FCI.DisplayName AS ‘Vault Store’,

FCD.SQLServer AS ‘SQL Server’,

FCD.DatabaseName AS ‘Database’

FROM

dbo.FingerprintCatalogueInstance AS FCI,

dbo.FingerprintCatalogueDatabase AS FCD

WHERE

FCI.FPCIIdentity=FCD.FPCIIdentity