Last active
January 4, 2017 18:19
-
-
Save weiyentan/d1c533bc498ccb3a69fac46c8d53f947 to your computer and use it in GitHub Desktop.
Example to copy object property to hashtable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$copyobjectdetails = $inputobject | Get-Member | Where-Object { $_.membertype -eq "Noteproperty" } | |
$hash = @{ } | |
$copyobjectdetails | ForEach-Object { | |
$name = $_.Name | |
$definition = $_.Definition | |
$definitionsplit = ($definition -split '=')[1] | |
$hash.Add($name, $definitionsplit) | |
} | |
$finalhash = @{ 'Path' = $testpath; 'Parameters' = $hash } | |
$param = @{ | |
'script' = $finalhash | |
} | |
Invoke-Pester @param |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment