Skip to content

Instantly share code, notes, and snippets.

@weiyentan
Last active January 4, 2017 18:19
Show Gist options
  • Save weiyentan/d1c533bc498ccb3a69fac46c8d53f947 to your computer and use it in GitHub Desktop.
Save weiyentan/d1c533bc498ccb3a69fac46c8d53f947 to your computer and use it in GitHub Desktop.
Example to copy object property to hashtable
$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