I’m sad to say this, but I was not able to find a default hash.merge command in powershell. So, after spending some time researching, i just had to bite the bullet and make my own function for merging. Hope this helps
function Merge-Hash{
param($parentHash, $childHash)foreach ($childKey in $childHash.keys){
$parentHash.$childKey = $childHash.$childKey
}return $parentHash
}
To test it, you can use this simple call in powershell
$hash1 = @{“a”=”1″;”b”=”2″;”c”=”3″}
03 Jun
Posted by: Dima in: Automation, powershell
The story:
I have several powershell scripts that I want to trigger via website, these scripts will start doing a lot of things on different computers on my network. We chose to use PowershellASP as the website server app, that allows you to call PS scripts from withing the HTML. This product works great! Check it out.
The Problem:
If you wish to invoke a command with PSASP, you just put in a PS snippet in HTML and your script is ran
< % Invoke-Command -ScriptBlock { Get-Services }