![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Howto create custom objects/classes Hi, when using vbscript, i created a class with several propertys and methods. The main purpose was to create standardized scripts while reducing the coding. I want to change to powershell scripting and want to create the similar to my vbscript class. Something like: class foo property log property errorlog method init method add method run function finish(runlevel) end i thought about something like this in powershell scripting language: $myScript = New foo (This is the predefinied Framework in powershell) $myScript.init run powershell scripts ... $myScript.finish(1) My problem is, that i did not find anything that could help me. Kind Regards Carson |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Howto create custom objects/classes Carson wrote: Quote: > Hi, > when using vbscript, i created a class with several propertys and methods. > The main purpose was to create standardized scripts while reducing the coding. > I want to change to powershell scripting and want to create the similar to > my vbscript class. > > Something like: > class foo > property log > property errorlog > method init > method add > method run > function finish(runlevel) > end > > i thought about something like this in powershell scripting language: > > $myScript = New foo (This is the predefinied Framework in powershell) > $myScript.init custom object is easy... To create proproties for an object: http://www.bsonposh.com/modules/wordpress/?p=25 An example of methods: http://groups.google.com/group/micro...0c2980fea1a925 Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Howto create custom objects/classes On 28 ÍÁÒ, 19:52, Carson <Car...@xxxxxx> wrote: Quote: > Hi, > when using vbscript, i created a class with several propertys and methods. > The main purpose was to create standardized scripts while reducing the coding. > I want to change to powershell scripting and want to create the similar to > my vbscript class. > > Something like: > class foo > š š š šproperty log > š š š šproperty errorlog > š š š šmethod init > š š š šmethod add > š š š šmethod run > š š š šfunction finish(runlevel) > end > > i thought about something like this in powershell scripting language: > > $myScript = New foo (This is the predefinied Framework in powershell) > $myScript.init > > run powershell scripts ... > > $myScript.finish(1) > > My problem is, that i did not find anything that could help me. > > Kind Regards > > Carson Look here get-help add-member -full and here http://www.manning.com/payette/WPA_Example_Code.zip Open folder 'chapter08' |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| howto backup custom emoticons for Messenger Live in Vista | Vista file management | |||
| Can I create a Default output format for custom objects | PowerShell | |||
| PowerShell Custom Objects | PowerShell | |||
| Using entlib 2 from custom objects | PowerShell | |||
| Info: Can you create your own objects with custom properties. | PowerShell | |||