Thursday 25 February 2016

Create Logon Script - NetLogon

Auto map network drives on login for all users
  1. Save the following batch file to the domain controller's NETLOGON share as logon.bat:
    @echo off
    net use * /delete /yes
    net use x: \\server_name\shared_directory_name
  2. Active Directory Users and Computers
  3. Right click domain name at top left and click Properties > Group Policy > Edit > User Configuration > Windows Settings > Scripts (Logon/Logoff) > Logon > Add...
  4. Enter path to logon.bat (e.g., \\ACME.local\sysvol\ACME.local\scripts\logon.bat) and click OK three times
  5. Login from workstation. Drive x: should appear in My Computer.
Auto map network drives on login for certain users:
  1. Save the following batch file to the domain controller's NETLOGON share as logon.bat:
    @echo off
    net use * /delete /yes
    net use x: \\file_server_name\shared_directory_name
  2. Active Directory Users and Computers > Users > Double click user > Profile
  3. Enter "logon.bat" (no quotes) in the "Logon script" box and click OK
  4. Login from workstation as user modified in step 2. Drive x: should appear in My Computer.

Monday 22 February 2016

Sysprep failed

As a work around of this problem, please type: regedit in the Start Search box to open Registry Editor, set the value of GeneralizationState under HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus to 7, then run sysprep again.

Setup RDS 2012r2

https://www.virtuallyboring.com/setup-remote-desktop-services-in-windows-server-2012-r2/

Remove old server from Active Directory

  1. Connect to the domain controler
  2. Launch the run dialog (Windows Key + R)
  3. Type in the command “adsiedit.msc” et then press “OK”
  4. Right click on the console then “Connect to:”
  5. In the connexion dialog select “Well known Naming Context”
  6. In the drop down menu select “Configuration”
  7. Explode “CN=Configuration [domain]\CN=Services\CN=Microsoft Exchange\CN=[organization]\CN=Administrative Groups\CN=Servers”
  8. Right click on the dead server and pick “Delete”
  9. We also need to delete Database information as well, navigate to “CN=Configuration [domain]\CN=Services\CN=Microsoft Exchange\CN=[organization]\CN=Administrative Groups\CN=Databases”
  10. Explode each items to find wich one is related to the old server, then delete it as well.

Exchange 2010 prerequisites and install - server 2012

Exchange 2010 prerequisites for server 2012 on a 2012r2 domain

"Open powershell with administrator privileges"  

Type(or paste):

Import-Module Servermanager

Type(or paste):

Install-WindowsFeature AS-HTTP-Activation, Desktop-Experience, NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, RSAT-Clustering-Mgmt, RSAT-Clustering-PowerShell, Web-Mgmt-Console, WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth, Web-Client-Auth, Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression, Web-Http-Errors, Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Lgcy-Mgmt-Console, Web-Metabase, Web-Mgmt-Console, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor, Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth, Web-WMI, Windows-Identity-Foundation

Install Net Framework 3.5 plus http activation 
from Roles and Features

After this has completed, install the following:
1st: Office 2010 Filter Packs
https://www.microsoft.com/en-gb/download/confirmation.aspx?id=17062
2nd: Filter Packs Service Pack 1
https://www.microsoft.com/en-us/download/details.aspx?id=26604

Exchange 2010 service pack 3:
https://www.microsoft.com/en-gb/download/details.aspx?id=36768 

source:https://www.youtube.com/watch?v=mvjFW3hic3A 

Thursday 18 February 2016

Remove Disconnected Mailbox using Powershell

 
Remove-StoreMailbox -Database DB?? -Identity "????" -MailboxState SoftDeleted
 
OR
 
Remove-StoreMailbox -Database DB?? -Identity "????" -MailboxState Disabled





Tuesday 16 February 2016

Enabling and disabling Outlook Anywhere Per User

Using Exchange Powershell the following below can enable and disable outlookanwywhere.

To enable outlook anywhere for a single user:
Get-Mailbox –Identity "username" | Set-CASMailbox -MAPIBlockOutlookRpcHttp:$False

To disable outlook anywhere for a single user:
Get-Mailbox –Identity "username" | Set-CASMailbox -MAPIBlockOutlookRpcHttp:$True

To enable it for all users:
Get-Mailbox –ResultSize Unlimited | Set-CASMailbox -MAPIBlockOutlookRpcHttp:$False

To disable it for all users:
Get-Mailbox –ResultSize Unlimited | Set-CASMailbox -MAPIBlockOutlookRpcHttp:$True


To enable it for multiple users only:

Create text file:
Username1
Username2
etc

  • Now save this text file to any locationu. Name it users.txt. For example C:users.txt
  Next run the script below:

$Mailboxes = Get-Content C:users.txt
Foreach ($Mailbox in $Mailboxes)
{
Set-CASMailbox -Identity $Mailbox -MAPIBlockOutlookRpcHttp:$false -Verbose
}


To disable it for multiple users only:

Create text file:
Username1
Username2
etc

  • Now save this text file to any locationu. Name it users.txt. For example C:users.txt
  Next run the script below:

$Mailboxes = Get-Content C:users.txt
Foreach ($Mailbox in $Mailboxes)
{
Set-CASMailbox -Identity $Mailbox -MAPIBlockOutlookRpcHttp:$true -Verbose
}


Tuesday 2 February 2016

Copy folder from one location to another and keep the same permissions.

Purpose:
Copy folder from one location to another and keep the same permissions.

The folder you copy cannot have inherit from root permissions on ,
otherwise the permissions won't copy.

Next open command prompt and enter the following.

ROBOCOPY "C:\LocationOfFolder\examplefolder" "C:\DestinationOfFolder\folder\examplefolder" /E /Copy:S /IS /IT