Sample of declare a simple powershell class with a constructor


/ Published in: Windows PowerShell
Save to your folder(s)

Sample of declare a simple powershell class with a constructor
thanks to Tome Tanasovski (http://powertoe.wordpress.com)


Copy this code and paste it in your HTML
  1. #Sample of declare a simple powershell class with a constructor
  2. #thanks to Tome Tanasovski (http://powertoe.wordpress.com)
  3. function ExtendedWebClient ()
  4. {
  5. param(
  6. [Parameter(Mandatory=$true)]
  7. [String]$url,
  8. [Parameter(Mandatory=$false)]
  9. [string]$timeout
  10. )
  11.  
  12. $webclient = "" | Select url,timeout
  13. $webclient.url = $url
  14. $webclient.timeout = $timeout
  15.  
  16. $webclient;
  17. }
  18.  
  19. cls
  20. $extclient = ExtendedWebClient "www.myurl.com" 100
  21. $extclient

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.