Kressmark Unified Communications: Skype for Business Readiness Series (3/15)

http://kressmark.blogspot.se/2015/03/skype-for-business-readiness-series-315.html?m=1

The Importance of Updated Domain Controllers When Deploying Exchange | Troubleshooting Exchange

https://exchangemaster.wordpress.com/2015/03/25/the-importance-of-updated-domain-controllers-when-deploying-exchange/

TechNet Skype for Business 2015 Visio Stencil

https://gallery.technet.microsoft.com/Skype-for-Business-2015-4a8f03dc

Lync / Skype for Business – Network Planning for the SILK codec |

http://consulting.risualblogs.com/blog/2015/03/17/lync-skype-for-business-network-planning-for-the-silk-codec/

Quickly turn SkypeUI on and off without opening Regedit – Skype for Business Preview | Mandie’s Memos

http://mandie.net/2015/03/18/skypeui-switch-in-powershell/

Modifying Diversion Header on Sonus for Unscreened ANI | Hab’s Blog

http://www.wavecoreit.com/blog/enterprise-voice/modifydiversionheader/

Automatically Create RDCMAN Rdg files for your Lync and Exchange Environments

You know the drill: You start a new project or need to configure a bunch of Lync, Exchange or any type of servers really. You are like me, which is to say lazy, and need to create way to connect to each machine via RDP but don’t want to have to input each server name one at a time via Microsoft Remote Desktop Connection Manager (RDCMAN). RDCMAN is a great, free utility from Microsoft but to doesn’t offer a lot of flexibility in importing machine names other than a simple text file. Third party products such as RoyalTS and MRemoteNG can do some automatic exploring of and importing from Active Directory to dynamically add machines. This post will focus on using RDCMAN and will leverage the New-RDCmanFile script from MVP Jan Egil Ring to demonstrate ways to customize this script to query AD for different server types. In addition, I will also discuss some Lync-specific ways to generate an RDCMAN file for Lync servers in a topology.

Using the New-RDCmanfile.ps1 script is pretty straightforward, but I will annotate the section you need to consider to get the results you need. I am also reposting this with full attribution to MVP Jan Egil Ring @JanEgilRing and a huge thank you as well!

New-RDCMANfile.PS1

########################################################################### 
# 
# NAME: New-RDCManFile.ps1 
# 
# AUTHOR: Jan Egil Ring 
# EMAIL: jer@powershell.no 
# 
# COMMENT: Script to create a XML-file for use with Microsoft Remote Desktop Connection Manager 
#          For more details, see the following blog-post: http://blog.powershell.no/2010/06/02/dynamic-remote-desktop-connection-manager-connection-list 
# 
# You have a royalty-free right to use, modify, reproduce, and 
# distribute this script file in any way you find useful, provided that 
# you agree that the creator, owner above has no warranty, obligations, 
# or liability for such use. 
# 
# VERSION HISTORY: 
# 1.0 02.06.2010 - Initial release 
# 
########################################################################### 
 
#Importing Microsoft`s PowerShell-module for administering ActiveDirectory 
Import-Module ActiveDirectory 
 
#Initial variables 
$domain = $env:userdomain 
$OutputFile = "$home\$domain.rdg" 
 
#Create a template XML 
$template = @' 
<?xml version="1.0" encoding="utf-8"?> 
<RDCMan schemaVersion="1"> 
    <version>2.2</version> 
    <file> 
        <properties> 
            <name></name> 
            <expanded>True</expanded> 
            <comment /> 
            <logonCredentials inherit="FromParent" /> 
            <connectionSettings inherit="FromParent" /> 
            <gatewaySettings inherit="FromParent" /> 
            <remoteDesktop inherit="FromParent" /> 
            <localResources inherit="FromParent" /> 
            <securitySettings inherit="FromParent" /> 
            <displaySettings inherit="FromParent" /> 
        </properties> 
        <group> 
            <properties> 
                <name></name> 
                <expanded>True</expanded> 
                <comment /> 
                <logonCredentials inherit="None"> 
                    <userName></userName> 
                    <domain></domain> 
                    <password storeAsClearText="False"></password> 
                </logonCredentials> 
                <connectionSettings inherit="FromParent" /> 
                <gatewaySettings inherit="None"> 
                    <userName></userName> 
                    <domain></domain> 
                    <password storeAsClearText="False" /> 
                    <enabled>False</enabled> 
                    <hostName /> 
                    <logonMethod>4</logonMethod> 
                    <localBypass>False</localBypass> 
                    <credSharing>False</credSharing> 
                </gatewaySettings> 
                <remoteDesktop inherit="FromParent" /> 
                <localResources inherit="FromParent" /> 
                <securitySettings inherit="FromParent" /> 
                <displaySettings inherit="FromParent" /> 
            </properties> 
            <server> 
                <name></name> 
                <displayName></displayName> 
                <comment /> 
                <logonCredentials inherit="FromParent" /> 
                <connectionSettings inherit="FromParent" /> 
                <gatewaySettings inherit="FromParent" /> 
                <remoteDesktop inherit="FromParent" /> 
                <localResources inherit="FromParent" /> 
                <securitySettings inherit="FromParent" /> 
                <displaySettings inherit="FromParent" /> 
            </server> 
        </group> 
    </file> 
</RDCMan> 
'@ 
 
#Output template to xml-file 
$template | Out-File $home\RDCMan-template.xml -encoding UTF8 
 
#Load template into XML object 
$xml = New-Object xml 
$xml.Load("$home\RDCMan-template.xml") 
 
#Set file properties 
$file = (@($xml.RDCMan.file.properties)[0]).Clone() 
$file.name = $domain 
$xml.RDCMan.file.properties | Where-Object { $_.Name -eq "" } | ForEach-Object  { [void]$xml.RDCMan.file.ReplaceChild($file,$_) } 
 
#Set group properties 
$group = (@($xml.RDCMan.file.group.properties)[0]).Clone() 
$group.name = $env:userdomain 
$group.logonCredentials.Username = $env:username 
$group.logonCredentials.Domain = $domain 
$xml.RDCMan.file.group.properties | Where-Object { $_.Name -eq "" } | ForEach-Object  { [void]$xml.RDCMan.file.group.ReplaceChild($group,$_) } 
 
#Use template to add servers from Active Directory to xml  
$server = (@($xml.RDCMan.file.group.server)[0]).Clone() 
Get-ADComputer -LDAPFilter "(operatingsystem=*server*)" | select name,dnshostname |  ForEach-Object { 
$server = $server.clone()     
$server.DisplayName = $_.Name     
$server.Name = $_.DNSHostName 
$xml.RDCMan.file.group.AppendChild($server) > $null#Remove template server 
$xml.RDCMan.file.group.server | Where-Object { $_.Name -eq "" } | ForEach-Object  { [void]$xml.RDCMan.file.group.RemoveChild($_) } 
 
#Save xml to file 
$xml.Save($OutputFile) 
 
#Remove template xml-file 
Remove-Item $home\RDCMan-template.xml -Force

The most salient bit of code we want to look at is highlighted above (line 110 if you are using your favorite text editor or ISE). We will explore this query and show some examples you can use here to get what you need into RDCMAN.

Get-ADComputer -LDAPFilter "(operatingsystem=*server*)" | select name,dnshostname

So we see here Jan is doing a Get-AdComputer with an LDAPFilter of operatingsystem=*server*. This will go out into AD and find all machines accounts that are labeled with “server” for the operating system attribute, just select the ‘name’ and ‘dnshostname’ (FQDN) and create server objects in RDCMAN where ‘name’ is Display name and ‘dnshostname’ is the machines FQDN. Awesome right?

So what if you want to just find, say, all Lync of Skype for Business (SfB) servers in the organization, or at least enough to get started?

By replacing the LDAPFilter, or the whole line with your own query, you can tailor this part of the script to get the servers you want into a nice RDCMAN file. And yes, they are in fact very nice.

For example, lets say you want to find all Lync\SfB servers in the domain (Forest as well but I did have some issues with using some Lync Universal Groups with certain queries if Lync machines were in multiple domains: more on this later).

You could do:

Get-ADComputer -LDAPFilter (showmethemoney=*lyncservers*)" | select name,dnshostname 

No, kidding. I did look for creative ways to get Lync servers specifically though. One way would be to use the Get-ADComputer cmdlet with an LDAPFilter of serviceprincipalname, in this case ‘SIP’. So:

Get-ADComputer -LDAPFilter (serviceprincipalname=*sip*)" | select name,dnshostname |  

We get:

NewImage

Boom. We will get a completed RDG file with these server objects. Note the script places the completed RDG file in the root of the users Home directory and the file is in the format of DOMAIN.RDG.

NewImage

Opening Contoso.rdg we get:

NewImage

Nice right? Now the downside with this method if you were singing along; it will only pick up registrars. Standard Edition Servers, Enterprise Front End Servers, and Survivable Branch Servers\Appliances (SBS\SBA). No Mediation, Edge, etc.

So how about another method you say? Ok then lets see….

For Lync\SfB, what other ways can we identify Lync servers from their AD attributes? How about the RTCComponentUniversalServices Universal Group? Saywha? This group should hold all Lync\SfB computer objects save for Edge Servers. Bummer, I know. Lets see what that query would look like. Using Get-ADComputer again, lets change the LDAPFilter for look up this groups membership:

Get-ADComputer -LDAPFilter "(&(&(&(&(&(objectCategory=computer)(memberOf=CN=RTCComponentUniversalServices,CN=Users,DC=contoso,DC=net)))))) | select name,dnshostname 

Now we should pick up any standalone mediation servers as well. Referring to the note above, I did notice that if you have Lync servers in different domains, so say a root and child domains, the RTCComponentUniversalServices group will contain computer objects from all domains, but the query will only see the computer accounts in the domain the group exists in. There may be a way to recursively search all domains but I couldn’t figure it out. Thanks for the help @maxsanna. This is likely to be a corner case at any rate as I have only seen a few deployments like this.

This gives us:

NewImage

Downside here is that there is no DNSHOSTNAME attribute via the group, so you may have to alter the server connection objects if the short name doesn’t resolve in your environment.

Another way that I came up with that is not as pretty and automated as it is with Jan’s script is to get all the Lync\SfB servers in a topology by running:

Get-CsManagementStoreReplicationStatus | Where {$_.ProductVersion -ne “”} | Select-Object ReplicaFQDN > contoso.txt

This assumes you already have a Lync environment deployed of course. This will pick up all servers in the topology, however it will pick up some unwanted objects like trusted applications but you can just remove those afterwords. I run the above cmdlet and pipe it to a text file. Then open up RDCMAN and click Edit, Import Servers, and poof! you have yourself an easy RDG with all your Lync\SfB servers. You can see I picked up some junk in the export.

NewImage

So what about another product like Exchange? Thats easy, just go to https://portal.microsoftonline.com I kid, I kid.

I looked at a couple ways, one being the group membership of the ‘Exchange Install Domain Servers Global Group located in the ‘Microsoft Exchange System Objects’ OU. The DN should be as follows:

CN=Exchange Install Domain Servers,CN=Microsoft Exchange System Objects,DC=contoso,DC=net

All Exchange servers should have their machine accounts in this groups membership. So, using this query in Jan’s script:

Get-ADComputer -LDAPFilter "(&(&(&(&(&(objectCategory=computer)(memberOf=CN=Exchange Install Domain Servers,CN=Microsoft Exchange System Objects,DC=contoso,DC=net)))))) | select name,dnshostname 

We will get an RDG with all Exchange servers connection objects.

NewImage

Or, howsabout a serviceprincipalname of *exchange*

Get-ADComputer -LDAPFilter (serviceprincipalname=*Exchange*)" | select name,dnshostname

NewImage

Boom! And yes, I did used to name my servers after star wars planets and star destroyers.

I hope this is useful and again, many thanks to Jan Egil Ring for the New-RDCManfile script.

Please, if I screwed anything up let me know and if you have better ways of doing this please comment I want this to evolve into something better than my weak powershell skills will allow.

And now I know….

….and knowing is half the battle.

Mandie's Memos

Learning about Lync and other technologies the hard way... so you don't have to.

The Networking Nerd

Networking With A Side of Snark

Norwegian Lync Day

For de som vil mer med Lync

Exchange Goddess

I'm here for the refreshments. About cows, goats, and surviving in IT as a woman

A bit of Exchange & Office 365

Blog of an Exchange Microsoft Certified Master & MVP

NorthernUC

The World of Lync 2010 & Lync 2013

The Lync

Tom Kisner's Microsoft Unified Communications Blog

msunified.net

Technical blog about Exchange, OCS and Lync by Ståle Hansen

MyExchangeLync

An another Exchange fellow !!!

ODDYTEE

All about messaging (and maybe some other stuff too).

www.WeakestLync.com (Lync and Skype for Business)

Follow on Twitter @WeakestLync #Lync #Skype4B

Unified Blog

Focused on Unified Communications & Collaboration

Unified Communications...

...The Microsoft Lync Way

Chad McGreanor's Blog

Engineers Notebook

Thoughtsofanidlemind's Blog

Exchange, Office 365, technology, and anything else really...

Working Hard In IT

My view on IT from the trenches

Steve Goodman's Exchange & Office 365 Blog

The weblog of an Microsoft MVP and IT Pro specialising in Exchange, Lync, Office 365. Guides, Tutorials, How-Tos and commentary.

Ehlo World!

All about Microsoft Unified Communications

Michael 'Van Hybrid' / Van Horenbeeck

My personal trash of thoughts about Unified Communications and stuff

Cloudy Migration Life

Blog for Active Directory and Exchange migration projects. Insights into Active Directory Federation Services and Web Application Server.

Follow

Get every new post delivered to your Inbox.

Join 1,444 other followers