Powershell function inside a string

This may seem strange but I am trying to store powershell functions in a SQL table.

I can do the SQL part but when I try to import the functions stored inside a string I get nothing.

For example:

$test = "function hello() { write-host ""hello world"" }"
$ps = New-Module -Name PS -ScriptBlock {$test} -AsCustomObject
$ps | gm

I get the following output:

   TypeName: System.Management.Automation.PSCustomObject

Name        MemberType Definition                    
—-        ———- ———-                    
Equals      Method     bool Equals(System.Object obj)
GetHashCode Method     int GetHashCode()             
GetType     Method     type GetType()                
ToString    Method     string ToString()     

No function

Read full post . . . .

Go Que Newsroom