update
This commit is contained in:
+16
-13
@@ -9,10 +9,13 @@ $ModuleURL = "https://dev.emberkom.com/emberkom/management-scripts/raw/branch/ma
|
||||
|
||||
## Setup the MSP management directories
|
||||
If ( Test-Path ${Env:ProgramData} )
|
||||
{ $RootDir = "${Env:ProgramData}\${MSPName}" } Else { $RootDir = "${Env:SystemDrive}\${MSPName}" }
|
||||
{ $MSPRoot = "${Env:ProgramData}\${MSPName}" } Else { $MSPRoot = "${Env:SystemDrive}\${MSPName}" }
|
||||
$MSPScripts = "${MSPRoot}\Scripts"
|
||||
$MSPTools = "${MSPRoot}\Tools"
|
||||
$MSPLogs = "${MSPRoot}\Logs"
|
||||
|
||||
## Set the path to this module and make the directory for it
|
||||
$ModulePath = "${RootDir}\Scripts\${ModuleName}"
|
||||
$ModulePath = "${MSPRoot}\Scripts\${ModuleName}"
|
||||
|
||||
## Create the path to the module
|
||||
If ( !(Test-Path $ModulePath) )
|
||||
@@ -22,33 +25,33 @@ If ( !(Test-Path $ModulePath) )
|
||||
}
|
||||
|
||||
## Set the environment variable to the module
|
||||
[System.Environment]::SetEnvironmentVariable('MSPPSModule',"${RootDir}\Scripts\${ModuleName}",[System.EnvironmentVariableTarget]::Machine)
|
||||
[System.Environment]::SetEnvironmentVariable('MSPPSModule',"${MSPRoot}\Scripts\${ModuleName}",[System.EnvironmentVariableTarget]::Machine)
|
||||
|
||||
## Make sure all the management directories exist
|
||||
If ( !(Test-Path $RootDir) )
|
||||
If ( !(Test-Path $MSPRoot) )
|
||||
{
|
||||
Try { New-Item -Path $RootDir -ItemType Directory -Force | Out-Null }
|
||||
Try { New-Item -Path $MSPRoot -ItemType Directory -Force | Out-Null }
|
||||
Catch { Write-Output $_.Exception.Message }
|
||||
}
|
||||
If ( !(Test-Path "${RootDir}\Scripts") )
|
||||
If ( !(Test-Path $MSPScripts) )
|
||||
{
|
||||
Try { New-Item -Path "${RootDir}\Scripts" -ItemType Directory -Force | Out-Null }
|
||||
Try { New-Item -Path $MSPScripts -ItemType Directory -Force | Out-Null }
|
||||
Catch { Write-Output $_.Exception.Message }
|
||||
}
|
||||
If ( !(Test-Path "${RootDir}\Tools") )
|
||||
If ( !(Test-Path $MSPTools) )
|
||||
{
|
||||
Try { New-Item -Path "${RootDir}\Tools" -ItemType Directory -Force | Out-Null }
|
||||
Try { New-Item -Path $MSPTools -ItemType Directory -Force | Out-Null }
|
||||
Catch { Write-Output $_.Exception.Message }
|
||||
}
|
||||
If ( !(Test-Path "${RootDir}\Logs") )
|
||||
If ( !(Test-Path $MSPLogs) )
|
||||
{
|
||||
Try { New-Item -Path "${RootDir}\Logs" -ItemType Directory -Force | Out-Null }
|
||||
Try { New-Item -Path $MSPLogs -ItemType Directory -Force | Out-Null }
|
||||
Catch { Write-Output $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Create environment variable for the root MSP directory
|
||||
[System.Environment]::SetEnvironmentVariable('MSPDir',"${RootDir}",[System.EnvironmentVariableTarget]::Machine)
|
||||
[System.Environment]::SetEnvironmentVariable('MSPDir',"${MSPRoot}",[System.EnvironmentVariableTarget]::Machine)
|
||||
|
||||
## Download the module file
|
||||
Try { (New-Object Net.WebClient).DownloadFile($ModuleURL, "${RootDir}\Scripts\${ModuleName}\${ModuleName}.psm1") }
|
||||
Try { (New-Object Net.WebClient).DownloadFile($ModuleURL, "${MSPRoot}\Scripts\${ModuleName}\${ModuleName}.psm1") }
|
||||
Catch { Write-Output $_.Exception.Message }
|
||||
|
||||
Reference in New Issue
Block a user