Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
PowerShell Development
>
Cmdlet Development
PSSnap-in initialization / termination events
Last Post 21 May 2010 10:06 PM by
Joel "Jaykul" Bennett
. 1 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
Mike
New Member
Posts:2
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" Bennett
Basic Member
Posts:112
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.
Using PowerShell
--General PowerShell
--Books, Tools, and Videos
--Exchange Server
--Active Directory
--System Center Family
--Non-Microsoft Products
--SharePoint
--SQL Server
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
PowerShell Development
>
Cmdlet Development
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2