Revision: 68776
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 23, 2015 02:55 by jatubio
Initial Code
#Sample of declare a simple powershell class with a constructor and a simple method #Show also how to echo strings on console #Thanks to http://www.peterhenell.se/ function ExtendedWebClient ($url,$timeout) { $webclient = "" | Select url,timeout $webclient.url = $url $webclient.timeout = $timeout $webclient = $webclient | Add-Member ScriptMethod HelloWorld {"Hello world form {0}" -f $this.url} -passThru $webclient = $webclient | Add-Member ScriptMethod HelloSun {Write-Host ("Hello Sun " + $this.url)} -passThru $webclient; } cls $extclient = ExtendedWebClient "www.myurl.com" 100 $extclient.HelloWorld() $extclient.HelloSun() $extclient
Initial URL
Initial Description
Sample of declare a simple powershell class with a constructor and a simple method Show also how to echo strings on console Thanks to http://www.peterhenell.se/
Initial Title
Sample of declare a simple powershell class with a constructor and a simple method
Initial Tags
Initial Language
Windows PowerShell