header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
PSSnap-in initialization / termination events
Last Post 21 May 2010 10:06 PM by Joel "Jaykul" Bennett. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
MikeUser is Offline
New Member
New Member
Posts:2
Avatar

--
21 May 2010 02:06 PM
    I am writing a custom PSSnap-in which is a wrapper around a C++/CLI interop library which is itself a wrapper around a bunch of native code. The interop library has to be initialized before it can be used. In an ASP.NET app I put the init code in global.asax.cs by overriding Application_OnStart.

    I can't find an equivalent event in Powershell to ASP.NET's Application_OnStart or C++'s DllMain DLL_PROCESS_ATTACH events.

    Any suggestions?
    Joel "Jaykul" BennettUser is Offline
    Basic Member
    Basic Member
    Posts:112
    Avatar

    --
    21 May 2010 10:06 PM
    You can try using a static constructor for the snapin, or the cmdlets ...

    Or make it a module, and use an on-load script (you specify them in the metadata). Off the top of my head I can't think what gets called on-load in a snapin (there's a bunch of on-install stuff, but that won't help)
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer