Build an RDCMan (Remote Desktop Connection Manager) Config File Version 2.0

This script will import computernames into an RDCMan (Remote Desktop Connection Manager) template file. You can also create new groups and specify the groups to add the computers to.

 
 
 
 
 
4.2 Star
(5)
3,600 times
Add to favorites
3/29/2017
E-mail Twitter del.icio.us Digg Facebook
  • Nested Groups
    6 Posts | Last post November 06, 2018
    • Hi Ben,
      
      I can see that this was posted over a year ago.  Did you ever complete the script to handle nested groups?
    • Hi James . . I did not make any updates so far.
      
      How many levels did you want to nest?
    • Hi Ben,
      
      Thanks for the quick reply.
      
      I haven't got the spec yet as I'm just doing a proof of concept.  The first question I was asked when I demo'd it to my team mates (I started on this team on Monday) was 'Can it nest more levels?'.  I thought I'd ask you before I had a go at it myself.
      
      I can't imagine we'd need more that 4 levels.
      
      Thanks in advance for your help.
      
      Regards
      
      James
    • Hi Ben,
      
      I managed to do it myself.
      
      Let me know if you want to see my code.
      
      Thanks for your time.
      
      
    • Hey James, nice work, glad you sorted it. . .
      
      If you think it's something you want to share you should post it here on the repository. If you do let me know the link.
      
      I don't have any need for it at the moment. . . . One time I had to execute a command on around 500 Servers and there was no other way to connect than RDP. So I wrote this script to automate the connection process with the autologon settings in RDCMan. Then I connected, pasted in the single command and ran it and then logged off. . . boy was that fun.
    • Hi James/Ben,
      
      I see that James was able to get nesting to work. Can you please share the code?
      
      Thanks,
      Joseph Hoang
  • i created it from a csv using below code
    3 Posts | Last post November 06, 2018
    • CSV should have following columns
      ---------------------------------------
      GRPNAME,DISPNAME,SERVNAME|
      
      groupXML should be 
      ---------------------------------------
       [XML]$Group ="     
                  <group> 
                      <properties> 
                          <name>$GroupName</name> 
                          <expanded>True</expanded> 
                      </properties> 
                      <logonCredentials inherit='None'>
                      <profileName scope='File'>SOMEDOMAIN\SOMEUSER</profileName>
                      </logonCredentials>
                      <gatewaySettings inherit='None'>
      					<enabled>True</enabled>
      					<hostName>someserver.someserver.net</hostName>
      					<logonMethod>NTLM</logonMethod>
      					<localBypass>True</localBypass>
      					<credSharing>False</credSharing>
      					<profileName scope='File'>SOMEDOMAIN\SOMEUSER</profileName>
      				</gatewaySettings>
                  </group>" 
      ---------------------------------------
      code to populate groups and servers
      ---------------------------------------
      $ob=@()
      $properties = @{'grp'=$grp;
      'servname'=$serv;
      'disp'=$disp;
      }
      $a=""
      $newob=""
      $a = Import-Csv  "$home\Desktop\a.csv" | Group-Object GRPNAME,DISPNAME,SERVNAME 
      $a |    % {
      $RDCObject= New-Object -TypeName psobject -Property $properties
      $RDCObject.grp=$_.group.GRPNAME; 
      $RDCObject.servname =($_.group | % { $_.SERVNAME });
      $RDCObject.disp =($_.group | % { $_.DISPNAME }); 
      $ob += $RDCObject}
      
      $i=$ob.count
      $newob=  $ob | Group-Object grp
      foreach($a in $newob)
      { 
       Add-RDCManConfigv2    -groupname  $a.name.tostring()
      }
       
      foreach($b in $newob.group  )
      {
      	Add-RDCManConfigv2    -parent  $b.grp.tostring() -computername $b.servname.tostring()
      }
      
       
       
    • Hi M-MP,
       
      I have a couple of questions:
      1.  Do I need to add this to the "Add-RDCManConfigv2.ps1" ? if so where do I inject your script?
      
      2.  When I add my import-csv directory then run your script by itself I get the following error " Group-Object : Object reference not set to an instance of an object.
      At line:17 char:16
      + $newob=  $ob | Group-Object grp
      +                ~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [Group-Object], NullReferenceException
          + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.GroupObjectCommand
       
      You cannot call a method on a null-valued expression.
      At line:20 char:2
      +  Add-RDCManConfigv2    -groupname  $a.name.tostring()
      +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull"
    • I got this working. I was able to pull WSUS computernames and export as .csv then create a rdc manager based off of that.
      
      My next project is to do this same thing but import a server list into a layered(nested) rdcman. 
      
      
  • Loop through a list of servers.
    1 Posts | Last post December 14, 2016
    • I know this is a few years old. I was not able to work out the add to nested groups. but this will allow you to import a list from a text file into a pre-existing group. Hope this helps someone. I had about 1500 servers in over 30 groups I needed to create and organize. 
      
      here are my edits. 
      
      $GRPNME = Read-Host "Name of parent Group"
      
      
          [String]$Parent = $GRPNME,
          [String]$Template = "C:\temp\RDCTemplate.rdg",
         
      
                 $ComputerName | ForEach-Object {
      
           
      
         
       $split1 = $_.split(',')[0].split(' ')
       $split2 = $_.split(',')[1].split(' ')
      
      
          $Computer = $split1 
          $Computer1 = $split2
                  [XML]$Server ="
                  <server>
                      <name>$Computer</name>
                      <displayName>$Computer1</displayName>
      
      
      $list = Get-Content -Path C:\temp\list.txt
      
      foreach ($item in $list){
      
      write-host $item -ForegroundColor Green
      
      $item | Add-RDCManConfigv2}
      
      
              
      
      
  • Nesting Groups
    1 Posts | Last post September 13, 2013
    • Hey Ben,
      
      Is this the version that allows you to use nested groups? I don't know if I'd need that function or not, but if the functionality is around I'd like to have that version. If it's not public that's ok too. 
      
      Thanks for the awesome script!
  • Nesting Groups
    1 Posts | Last post August 03, 2013
    • If the code is complete for Nesting groups, can you make it availble for others?