Skip to content

Instantly share code, notes, and snippets.

@Bigtalljosh
Last active July 10, 2018 14:50
Show Gist options
  • Select an option

  • Save Bigtalljosh/771a2c3fcf1e609179a8c8c5f0990c27 to your computer and use it in GitHub Desktop.

Select an option

Save Bigtalljosh/771a2c3fcf1e609179a8c8c5f0990c27 to your computer and use it in GitHub Desktop.

Revisions

  1. Bigtalljosh renamed this gist Jul 10, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. Bigtalljosh created this gist Jul 10, 2018.
    25 changes: 25 additions & 0 deletions PoweshellToString
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    function Convert-HashToString
    {
    param
    (
    [Parameter(Mandatory = $true)]
    [System.Collections.Hashtable]
    $Hash
    )
    $hashstr = "@{"
    $keys = $Hash.keys
    foreach ($key in $keys)
    {
    $v = $Hash[$key]
    if ($key -match "\s")
    {
    $hashstr += "`"$key`"" + "=" + "`"$v`"" + ";"
    }
    else
    {
    $hashstr += $key + "=" + "`"$v`"" + ";"
    }
    }
    $hashstr += "}"
    return $hashstr
    }