update
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#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" }
|
||||
Reference in New Issue
Block a user