Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Need some fine-tuning of a script to remove mail and archive from old employee

$
0
0

This make look very crude to you Powershell gurus out there. I'm still getting my feet wet, but getting better.

Powershell
.'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'Connect-ExchangeServer-autoFunctionCleanup-User{[cmdletbinding()]Param([String]$Username)#Setting variables for later use.$aduser=get-aduser$username-Propertiesname$fullname=$aduser.name$QnapPath="\\192.168.2.212\Public\Terminated Employees"$Maiblox=Get-mailbox-identity$Username$Database=$mailbox.database.name#This is to confirm that a valid username has been used. Otherwise, the remove-item portion later on could do some damage.Write-Host"Do you want to proceed with the cleanup of $Fullname ?"pause#This creates a mapping to the network share.New-PSDrive-nameQnap-PSProviderFileSystem-Root$QnapPath...

Viewing all articles
Browse latest Browse all 15370

Trending Articles