Tuesday, January 26, 2016

[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}}

[AZR] Manage Azure VM IPs


Set static internal IP address:

Get-AzureVM -ServiceName MyCloudService -Name MyAzureVM | Set-AzureStaticVNetIP -IPAddress "10.1.1.4" | Update-AzureVM


Create a new reserved IP:

1. Create the Azure reserved IP:

New-AzureReservedIP -ReservedIPName MyReservedIP -Location "East US"

2. Associate with a cloud service 

Set-AzureReservedIPAssociation -ReservedIPName MyReservedIP -ServiceName MyCloudService 


Convert Dynamic VIP to Reserved IP in a cloud service:

New-AzureReservedIP -ReservedIPName MyReservedIP -Location "East US" -ServiceName MyCloudService 


Remove Reserved IP from the Deployment

Remove-AzureReservedIPAssociation -ReservedIPName MyReservedIP -ServiceName MyCloudService 

[EX2010] Install Exchange in Unattended Mode

Exchange 2010

Setup.com  /mode:Install /roles:ClientAccess,Mailbox,HubTransport /MdbName:IT /DbFilePath:c:\mbx\it.edb /Logfolderpath:c:\logs\it /ExternalCASServerDomain:mail.mydomain.usa /UpdatesDir:C:\Users\Administrator\Downloads\up

https://technet.microsoft.com/en-us/library/aa997281(v=exchg.141).aspx


Exchange 2013

Setup.exe  /mode:Install /roles:ClientAccess,Mailbox /MdbName:IT /DbFilePath:c:\mbx\it.edb /Logfolderpath:c:\logs\it /UpdatesDir:C:\Users\Administrator\Downloads\up  /IAcceptExchangeServerLicenseTerms



Saturday, January 9, 2016

[WSRV] Bulk change AD users password

$pwd = ConvertTo-SecureString -string "Pa$$w0rd" -AsPlainText -force

Get-ADUser -Filter * -SearchScope Subtree -SearchBase "OU=Sports,DC=domain,DC=local" | Set-ADAccountPassword -Reset -NewPassword $pwd