32 lines
1004 B
PowerShell
32 lines
1004 B
PowerShell
#Requires -Version 2.0
|
|
|
|
param(
|
|
[string]$Type='management-scripts',
|
|
[string]$Name,
|
|
[string]$Arguments)
|
|
|
|
## Get rid of null arguments
|
|
If ( $Arguments -eq "null" ) { $Arguments = $null }
|
|
|
|
## Make sure $Name and $Type are defined
|
|
If ( $Name -and $Type )
|
|
{
|
|
## Form the URL to the specified script
|
|
$URL = "https://dev.emberkom.com/emberkom/${Type}/raw/branch/master/${Name}.ps1"
|
|
|
|
## Get the script
|
|
Write-Output "Retrieving : ${Name}.ps1"
|
|
Try { $Script = (New-Object Net.WebClient).DownloadString($URL) }
|
|
Catch { Write-Output $_.Exception.Message }
|
|
|
|
## Make a script block
|
|
Try { $ScriptBlock = [Scriptblock]::Create($Script) }
|
|
Catch { Write-Output $_.Exception.Message }
|
|
|
|
## Run the script any any arguments
|
|
Write-Output "Executing: ${Name}.ps1 ${Arguments}"
|
|
Try { Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments }
|
|
Catch { Write-Output $_.Exception.Message }
|
|
}
|
|
|
|
Else { Write-Output "No script or type was specified" } |