User Tools

Site Tools


adsetup:options:filepaths

The script will try to identify some standard file paths via DFS1). These things are usually unique to environments, so each path can be updated manually. The paths are used at various locations in the script to update GP or GPP that require file copies or user locations to be setup properly.

Function FilePaths {
### Check to see if DFS is installed, if not use generic Folder locations
$DFSInstalled=(Get-WindowsFeature *FS-DFS-Namespace*).Installed
### Test to confirm DFS configuration
### $DFSInstalled = $False
If ($DFSInstalled -eq $False)
    {
        $DFSInstallFolder = "DFS NOT Installed - Update Manually"
        $DFSHomeFolder = "DFS NOT Installed - Update Manually"
        $DFSUSerDataFolder = "DFS NOT Installed - Update Manually"
        $DFSSourceFolder = "DFS NOT Installed - Update Manually"
    }

    Else {
        $DFSRoot = (Get-DFSnRoot).Path
        $DFSInstallFolder = (Get-DFSnFolder -Path "$DFSRoot\*" | Where-Object {$_.Path -Like "*Install*"})
    Try {
        $DFSInstallFolder = Get-DFSnFolder -Path $DFSInstallFolder.Path
        $DFSInstallFolderBlank = $False
    }

    Catch {$DFSInstallFolderBlank = $True}

Finally {
    
    If ($DFSInstallFolderBlank -eq $True) {$DFSInstallFolder = "\\Update Manually\"}
    Else{$DFSInstallFolder = $DFSInstallFolder.Path}

    }

        $DFSHomeFolder = (Get-DFSnFolder -Path "$DFSRoot\*" | Where-Object {$_.Path -Like "*Home*"})
    Try {
        $DFSHomeFolder = Get-DFSnFolder -Path $DFSHomeFolder.Path
        $DFSHomeFolderBlank = $False
    }
    Catch {$DFSHomeFolderBlank = $True}
    Finally {
    If ($DFSHomeFolderBlank -eq $True) {$DFSHomeFolder = "\\Update Manually\"}
    Else{
        $DFSHomeFolder = $DFSHomeFolder.Path}
    }

        $DFSUserDataFolder = (Get-DFSnFolder -Path "$DFSRoot\*" | Where-Object {$_.Path -Like "*UserData*"})
    Try {$DFSUserDataFolder = Get-DFSnFolder -Path $DFSUserDataFolder.Path
        $DFSUserDataFolderBlank = $False
    }
    Catch {$DFSUserDataFolderBlank = $True}
    Finally {
    If ($DFSUserDataFolderBlank -eq $True) {$DFSUserDataFolder = "\\Update Manually\"}
    Else{
        $DFSUserDataFolder = $DFSUserDataFolder.Path}
    }

        $DFSSourceFolder = (Get-DFSnFolder -Path "$DFSRoot\*" | Where-Object {$_.Path -Like "*Source*"})
    Try {$DFSSourceFolder = Get-DFSnFolder -Path $DFSSourceFolder.Path
        $DFSSourceFolderBlank = $False
    }
    Catch {$DFSSourceFolderBlank = $True}
    Finally {
    If ($DFSSourceFolderBlank -eq $True) {$DFSSourceFolder = "\\Update Manually\"}
    Else{
        $DFSSourceFolder = $DFSSourceFolder.Path}
    } 
    }

        $Script:DFSInstallFolder = $DFSInstallFolder
        $Script:DFSHomeFolder = $DFSHomeFolder
        $Script:DFSUSerDataFolder = $DFSUSerDataFolder 
        $Script:DFSSourceFolder = $DFSSourceFolder
} #End Function FilePaths
1)
The Default configuration of DFS is not to use full qualified name spaces, so this might resolve to NetBIOS path. If is a problem, run this command: Set-DfsnServerConfiguration –ComputerName <ServerName> –UseFqdn $true or see this page for more information before making any changes.
adsetup/options/filepaths.txt · Last modified: 2017/03/31 18:51 by rob