Tuesday, August 13, 2013

Query interface information on remote machines

I found a nice script for this task that can be found by following link:
Scrip Source

The powershell command to run in order to query list of computers from text file list would be as follows:
$computers = Get-Content -Path c:\scripts\servers.txt
.\getipinfo.ps1 -ComputerName $computers | ft -AutoSize


This is the actual script:
[cmdletbinding()]
param (
[parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
    [string[]]$ComputerName = $env:computername
)           

begin {}
process {
foreach ($Computer in $ComputerName) {
  if(Test-Connection -ComputerName $Computer -Count 1 -ea 0) {
   $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $Computer | ? {$_.IPEnabled}
   foreach ($Network in $Networks) {
    $IPAddress  = $Network.IpAddress[0]
    $SubnetMask  = $Network.IPSubnet[0]
    $DefaultGateway = $Network.DefaultIPGateway
    $DNSServers  = $Network.DNSServerSearchOrder
    $IsDHCPEnabled = $false
    If($network.DHCPEnabled) {
     $IsDHCPEnabled = $true
    }
    $MACAddress  = $Network.MACAddress
    $OutputObj  = New-Object -Type PSObject
    $OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper()
    $OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IPAddress
    $OutputObj | Add-Member -MemberType NoteProperty -Name SubnetMask -Value $SubnetMask
    $OutputObj | Add-Member -MemberType NoteProperty -Name Gateway -Value $DefaultGateway
    $OutputObj | Add-Member -MemberType NoteProperty -Name IsDHCPEnabled -Value $IsDHCPEnabled
    $OutputObj | Add-Member -MemberType NoteProperty -Name DNSServers -Value $DNSServers
    $OutputObj | Add-Member -MemberType NoteProperty -Name MACAddress -Value $MACAddress
    $OutputObj
   }
  }
}
}           

end {}

Controll Exchange 2010 mail delivery using cost and hub site

Set-ADSiteLink, this command would be very useful in cases where one wants to favor one site  for queuing  over another. The lower the cost more likely site will be used. Keep in mind that direct delivery is always attempted first and only if it fails site cost is used to queue messages in a different hub server in different site.

Set-ADSiteLink -Identity fromtositelink -ExchangeCost 5

Set-AdSite is a command that is used to enable particular hub in site to force all email to pass through it.

ENABLE:
Set-AdSite -Identity 'sitename' -HubSiteEnabled $true

DISABLE:
Set-AdSite -Identity 'sitename' -HubSiteEnabled $false

Modifying exchange 2010 receive connector using EMS

To modify existing receive connector by adding banner message and increasing size of messages allowed Set-ReceiveConnector command is used

Set-ReceiveConnector -Name 'Name of existing receive connector' -Banner '220 Custom application connector' -MaxMessageSize '20MB'

Creating exchange 2010 receive connector using EMS

Following command creates a connector to accept messages only from internal application server with IP 192.168.1.100

New-ReceiveConnector -Name 'New Receive Connector Name' -Usage Custom - bindings 0.0.0.0:25 -RemoteIPRanges '192.168.1.100' -Server 'Server Name' -AuthMechanism 'None'

Modifying exchange 2010 send connector using EMS


This command would enable protocol logging and increase message size to 20MB.


Set-SendConnector -Name 'Name of the connector' -ProtocolLoggingLevel 'Verbose' -MaxMessageSize '20MB'

Wednesday, July 10, 2013

Microsoft Active Directory Topology Diagrammer

Totally useful diagraming tool!!! It requires you to have Visio as well.
Get tool here from Microsoft

Microsoft Surface Pro going to sleep every 2 minutes

I have been dealing with this issue for a while now and kept putting it on back burner. Today I just got so pissed off that I decided to have this done now or never. And thank God I did!!

For whatever odd reason surface pro was going to sleep after 2 minutes no matter what my power options were set to. I tried all kinds of settings.

After some research I found that apparently there is a power setting not available in GUI on Microsoft windows 7 and 8 this setting is called "system unattended sleep timeout". If you add following registry setting:[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\7bc4a2f9-d8fc-4469-b07b-33eb785aaca0]
"Attributes"=dword:00000002

and go to power setting --> sleep - you will see a new option for "system unattended sleep timeout". Change this setting to your desired value and problems gone!!!!