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 Categories

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 512 bytes) in /home/content/36/8658336/html/goquecom/wp-includes/taxonomy.php on line 3363