Skip to content

Instantly share code, notes, and snippets.

@irwins
Created September 12, 2016 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irwins/d452431d678d93adde0a8372c9a091ab to your computer and use it in GitHub Desktop.
Save irwins/d452431d678d93adde0a8372c9a091ab to your computer and use it in GitHub Desktop.
<#
Author: I. Strachan
Version:
Version History:
Purpose: OVF DFS links & targets
#>
Param(
$csvFile = 'DFSnLinksTargets.csv'
)
Import-Module DFSN -Verbose:$false
#region Import CSV and saved Credentials
$csvDFSnTargets = Import-Csv -Path .\sources\csv\$($csvFile) -Delimiter "`t" -Encoding UTF8
$DfsnLinkTargets = Get-DfsnRoot |
ForEach-Object{
Get-DfsnFolder -Path "$($_.Path)\*" |
Get-DfsnFolderTarget |
Select-Object Path,TargetPath
}
#endregion
$lookupDFSn = $DfsnLinkTargets | Group-Object -AsHashTable -AsString -Property Path
#region Main
$csvDFSnTargets |
ForEach-Object{
Describe "DFSn Link & Target Operation validation share $($_.Link)" -Tags 'DFSnLinkTargets' {
Context "Verifying DFS Link $($_.Link)" {
It "DFS Link $($_.Link) exists" {
$lookupDFSn.$($_.Link).Path | Should be $_.Link
}
It "DFS Target $($_.Target) exists" {
$lookupDFSn.$($_.Link).TargetPath | Should be $_.Target
}
}
}
}
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment