Skip to content

Commit

Permalink
Add AzDo build & general folder organisation (#7)
Browse files Browse the repository at this point in the history
* Updated Readme with new functionality

* updated img paths

* Moved img folder into RDCManager sub-folder

* Moved img folder into RDCManager sub-folder

* added spaces for psm1 compilation

* Added FunctionsToExport manually

* Added build script for AzurePipelines
  • Loading branch information
brettmillerb authored Feb 2, 2019
1 parent 19fca25 commit e7da5bc
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 32 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out
5 changes: 4 additions & 1 deletion RDCManager/InitializeModule.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using namespace System.Xml.Linq
using assembly System.Xml.Linq

function InitializeModule {
Set-RdcConfiguration -Reset
}
}
23 changes: 18 additions & 5 deletions RDCManager/RdcManager.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,29 @@ PowerShellVersion = '5.1'
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = '*'
FunctionsToExport = @(
'Get-RdcConfiguration',
'Set-RdcConfiguration',
'ADConfiguration',
'RdcADComputer',
'RdcADGroup',
'RdcComputer',
'RdcConfiguration',
'RdcDocument',
'RdcGroup',
'RdcLogonCredential',
'RdcRemoteDesktopSetting'
)


# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = '*'
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = '*'
VariablesToExport = @()

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = '*'
AliasesToExport = @()

# DSC resources to export from this module
# DscResourcesToExport = @()
Expand All @@ -95,7 +108,7 @@ PrivateData = @{
PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
# Tags = @()
Tags = @('RDCMan', 'RDCManager', 'Remote Desktop Connection Manager')

# A URL to the license for this module.
# LicenseUri = ''
Expand Down
Binary file added RDCManager/img/ZMRivZa5sA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RDCManager/img/xIkQfDVql2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[cmdletbinding()]
param (
$SourceFolder = "$PSScriptRoot",
$Destination = "$PSScriptRoot\out"
)

function Get-FilesToMerge {
[cmdletbinding()]
param (
$Path = $PSScriptRoot
)

Get-ChildItem -Path $PSScriptRoot -Recurse -Include *.ps1 -Exclude build.ps1 |
Sort-Object FullName | ForEach-Object {
"Adding {0} to the psm1 file" -f $_.BaseName | Write-Verbose
Get-Content -Path $_.FullName | Add-Content -Path $Destination\RDCManager\RDCManager.psm1
"`r" | Add-Content -Path $Destination\RDCManager\RDCManager.psm1
}
}

if (Test-Path -Path $PSScriptRoot\out) {
Remove-Item -Path $Destination -Force -Confirm:$false -Recurse
}

# Remove out directory to allow rebuilding
$null = New-Item -ItemType Directory -Name RDCManager -Path $PSScriptRoot\out

Get-FilesToMerge

"Adding InitializeModule to the psm1 file" | Write-Verbose
"InitializeModule" | Add-Content -Path $Destination\RDCManager\RDCManager.psm1

"Copying Manifest file to {0}" -f $Destination | Write-Verbose
Copy-Item -Path $PSScriptRoot\RDCManager\*.psd1 -Destination $Destination\RDCManager

#$content -replace "^FunctionsToExport = '[*]'$", ("FunctionsToExport = @('{0}'`r`n)" -f ($pubfunctions -join "',`r`n`t'"))
95 changes: 69 additions & 26 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,91 @@
# Remote Desktop Manager File Generator ###
# Remote Desktop Manager File Generator

Idea taken from Kevin Marquette's RDCMan DSL to generate the entire XML for a new file.
~~Idea taken from Kevin Marquette's RDCMan DSL to generate the entire XML for a new file.~~

Now **very** loosely based on Kevin Marquette's RDCMan DSL blog post

https://kevinmarquette.github.io/2017-03-04-Powershell-DSL-example-RDCMan/

Reworked by [Chris Dent - Indented Automation](https://github.com/indented-automation)
Entirely reworked by [Chris Dent - Indented Automation](https://github.com/indented-automation)

## Usage
RDCManager alllows you to group servers and store configuration data so you can effectively manage your server estate from one window.

This module allows you to dynamically create the document for RDCManager by extracting the data from Active Directory. This saves you having to remember to add/remove servers as they change in your estate.

The module offers the option of using the Active Directory module if RSAT tools are installed otherwise you can specify to use LDAP to perform queries.

## Generating the document

### Manual computers
### RdcDocument
This must be specified as this is the starting point for you to begin defining groups/computers.

You can then define your document manually with the `RdcGroup` and `RdcComputer` functions.

Generates a file based on a manually defined list of computers.
```powershell
RdcDocument 'manual' {
RdcGroup 'Manual list' {
RdcComputer @{
Name = 'somehost1'
}
RdcComputer @{
Name = 'somehost2'
}
RdcDocument MyServers {
RdcGroup "My First Group" {
RdcComputer -Name 'server001' -DnsHostName 'server001.fqdn.com' -IPv4address '10.0.0.1'
RdcComputer -Name 'server002' -DnsHostName 'server002.fqdn.com' -IPv4address '10.0.0.2'
}
}
```
### Manual groups. Computers from AD.
#### Output
![RDCManBasicOutput](/img/ZMRivZa5sA.png)

### Generating a file with specific Active Directory filtering
```powershell
RdcDocument 'simpleAD' {
RdcGroup 'some servers' {
RdcADComputer -Filter { name -like 'some*' } -Recurse
}
RdcGroup 'other servers' {
RdcADComputer -Filter { name -like 'other*' } -Recurse
RdcDocument MyServers {
RdcGroup "My Group" {
# Will create a group with the OU name and any computer objects within
RdcADGroup -Identity 'OU=Newcastle,DC=millerb,DC=co,DC=uk'
#Add -Recurse switch and it will create a group for each sub OU and add members accordingly
RdcADGroup -Identity 'OU=London,DC=millerb,DC=co,DC=uk' -Recurse
# Will search for a specific server provided by the filter recursing all OU's
RdcADComputer -Name 'Admin*' -Recurse
}
}
```
### Automatic creation from OU structure

### Automatic creation from root of domain
This will create groups replicating the OU structure which contains computer objects.

```powershell
RdcDocument 'SomeOU' {
RdcADGroup -Identity 'OU=SomeOU,DC=somewhere,DC=com' -Recurse
RdcDocument 'Domain' {
RdcADGroup -Recurse
}
```
### Automatic creation from domain root

#### Output
![RDCManOutput](/img/xIkQfDVql2.png)

## Additional Functionality

#### RdcConfiguration
Sets the configuration to be used when generating the document. This is not required as if the AD module is detected this will be used unless ADSI is specified. If the AD Module is not available then ADSI LDAP filters will be used.

```powershell
RdcDocument 'Domain' {
RdcADGroup -Recurse
RdcConfiguration @{
SearchMode = 'ADSI'
FilterFormat = 'LDAP'
}
```

#### RdcLogonCredential
Allows credentials to be set at any level to support different domains/forests. May conflict with GPO's set to prevent saved passwords being used.

```powershell
RdcLogonCredential @{
Username = 'millerb-admin'
Domain = 'millerb.co.uk'
}
```
#### RdcRemoteDesktopSetting
Enables scaling of the connected client window.
```powershell
RdcRemoteDesktopSetting @{
SameSizeAsClientArea = $true
}
```

0 comments on commit e7da5bc

Please sign in to comment.