Tuesday, February 2, 2016

[EX2016] Pre-requisites

Exchange 2016

  • Mailbox (2012 R2)

Install-WindowsFeature RSAT-ADDS, 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, RSAT-DNS-Server, GPMC, Telnet-Client

.NET Framework 4.5.2
https://www.microsoft.com/en-us/download/details.aspx?id=42642

Unified Communications Managed API 4.0 Runtime



  • Edge Transport (2012 R2)

Install-WindowsFeature ADLDS

After you've installed the operating system roles and features, install .NET Framework 4.5.2
https://www.microsoft.com/en-us/download/details.aspx?id=42642


Friday, January 29, 2016

[O365] Recover messages deleted from Recoverable items folders


To verify the number of items:
Search-Mailbox "user@testtenant.com.br" -TargetMailbox "Discovery Search Mailbox" -TargetFolder "Recover1" -LogLevel Full -SearchDumpsterOnly -LogOnly

To copy the items to another user folder:
Search-Mailbox "user@testtenant.com.br" -TargetMailbox "user2@testtenant.com.br"  -TargetFolder "Recover1" -LogLevel Full -SearchDumpsterOnly

Tuesday, January 26, 2016

[WSRV] Retrieve user details from Active Directory using SID


$strSID="S-1-5-21-500000003-1000000000-1000000003-1001"
$uSid = [ADSI]"LDAP://<SID=$strSID>"
echo $uSid


distinguishedName : {CN=John Doe,OU=Domain Admins,OU=People,OU=xxx,DC=xxx}
Path              : LDAP://<SID=S-1-5-21-500000003-1000000000-1000000003-1001>

[WSRV] Reset the Secure Channel


netdom reset /d:devgroup.contoso.com mywksta


OR


nltest /sc_verify:iammred

ipconfig /flushdns
arp -d *
Get-Service netlogon | restart-service
nltest.exe /sc_verify:<fully.qualified.domain.name.here>


OR

nltest /SC_RESET:<DomainName> - Reset secure channel for <Domain> on <ServerName>

OR

Test-ComputerSecureChannel

Test-ComputerSecureChannel -Repair

Tuesday, January 19, 2016

[EX2013] Collect the virtual directories URLs

Run it directly in the EMS


"### OWA ###" | Out-File c:\url.txt -Append
Get-OwaVirtualDirectory | fl Name,Server,FailbackUrl,InternalUrl,ExternalUrl,*yV* | Out-File c:\url.txt -Append
"### ECP ###"  | Out-File c:\url.txt -Append
Get-EcpVirtualDirectory | fl Name,Server,*Url,*yV*  | Out-File c:\url.txt -Append
"### EWS ###" | Out-File c:\url.txt -Append
Get-WebServicesVirtualDirectory | fl Name,Server,*url,*yV* | Out-File c:\url.txt -Append
"### OAB ###" | Out-File c:\url.txt -Append
Get-OabVirtualDirectory | fl Name,Server,*url*,*yV*  | Out-File c:\url.txt -Append
"### EAS ###" | Out-File c:\url.txt -Append
Get-ActiveSyncVirtualDirectory | fl Name,Server,*url*,*yV*  | Out-File c:\url.txt -Append
"### OA ###"  | Out-File c:\url.txt -Append
Get-OutlookAnywhere | fl Name,Server,*Hostname,*Method*,*SSL*,*yV*  | Out-File c:\url.txt -Append
"### CAS ###"  | Out-File c:\url.txt -Append
Get-ClientAccessServer | fl Fqdn,AutoDiscoverServiceInternalUri,*Site*  | Out-File c:\url.txt -Append
.


(Exchange 2016 only)

"### MAPI ###" | Out-File c:\url.txt -Append
Get-MapiVirtualDirectory | fl Name,Server,*url*,*yV*  | Out-File c:\url.txt -Append

[WSRV] Provisioning a server core domain controller

powershell

$cn = hostname

netdom renamecomputer $cn /NewName:DC1

netsh interface ip set address "Ethernet" static 192.168.10.1 255.255.255.0 192.168.10.254

netsh interface ip add dns "Ethernet" 192.168.10.1

netsh interface ip add dns "Ethernet" 192.168.10.254 index=2


powershell

Install-WindowsFeature AD-Domain-Services

$SafePass = Read-Host "Password" -AsSecureString

Install-ADDSForest -DomainName domain.local -DomainNetbiosName MYDOMAIN -ForestMode Win2012R2 -DomainMode Win2012R2 -InstallDNS -NoDnsOnNetwork -SafeModeAdministratorPassword $SafePass



powershell

Add-DnsServerPrimaryZone -NetworkID "192.168.10.0/24" -ReplicationScope "Forest"


cscript C:\Windows\System32\Scregedit.wsf /ar 0

netsh advfirewall set currentprofile state off

[EX2010] Script to send test messages


To open connectors:

Get-ReceiveConnector |?{$_.Name -like "*defa*"} | Set-ReceiveConnector -PermissionGroups 'AnonymousUsers, ExchangeUsers, ExchangeServers, ExchangeLegacyServers'


To send test messages:

$domain = (Get-AcceptedDomain).name
$fqdn = "$env:computername.$env:userdnsdomain"
$date = Get-Date -UFormat "%m/%d/%Y"
$mbx = Get-Mailbox -RecipientTypeDetails UserMailbox
$tot = read-host "Messages per user"

while ($val -ne $tot) {$val++ ; $mbx | % -Process {Send-MailMessage -To $_.PrimarySmtpAddress -From noreply@$domain -Subject "Test Message from $date - Message # $val" -Body "Please don't reply this message. We are making some tests in our Exchange environment" -SmtpServer $fqdn}}