wanna write a plugin that reconnects network drives (1 Viewer)

mikey79

New Member
September 30, 2005
4
0
hi guys,

i plan to write a small plugin for mediaportal to connect to a list of network drives. wgen media portal is automatically loaded on startup, no network drives are established, so a batch-script or some other tools are necessary in order to do this. however, when media portal is run as a shell, it is not possible to use these extra tools any more. so i thought it might be convinient if MP does this automatically on startup and checks this now and then.
so i got some questions:

1. i only know c++, never have done any c#- is this really necessary? i only have visual studio 6, so in order to code a plugin do i really need .NET studio?

2. such a plugin, can it be loaded automatically on startup and reside working in the background? i guess so, since all lcd plugins should work like this too, don't they?
 

zasghu

New Member
October 2, 2005
1
0
1. As I know it you don't need C# or VB.Net for making plug-ins for Media Portal but you need to have .NET because Media Portal is all build on that.

2. You can make a easy bat file to map some shares
In 2000/XP/2003 at least can you just use

net use D: \\server\share\

or you can use a vbs script
Set WSHNetwork = CreateObject("WScript.Network")
WSHNetwork.MapNetworkDrive "D:", "\\server\share",false

and put it in start up
 

SiLenTYL

Retired Team Member
  • Premium Supporter
  • April 23, 2004
    1,144
    159
    Melbourne
    Home Country
    Australia Australia
    great idea guys...

    mickey79 mentioned on this thread there is an app for windows called Network Drive Manager which does this for all unestablished network connections ...HERE ...

    however native support is always a better option

    i know i will definitely find this very handy
     

    mikey79

    New Member
    September 30, 2005
    4
    0
    zasghu: yes, i know the "work-arounds" and hacks. but i am aiming at a htpc that boots without any dos windows or stuff. and if i use media portal as a shell, the programs in the startup folder are not run anymore. so, the only reason is to have either a service or a plugin that does this for you. i played around with services over this weekend and programmed one that remaps the network drives. however, it does not work that easy, because the service is already running if you are not logged in. and even if you tell the service to run under a specific user name, windows somehow does not remember those mapped network drives if you actually log in by yourself, meaning: the service maps the drive correctly and establishes the connections but you dont see the drives as a user then :-(

    here's what i found on the microsoft support site (http://support.microsoft.com/default.aspx?scid=kb;en-us;Q180362):

    If a service is configured to run under a user account, the system will always create a new logon session for the user and then launch the service in that new logon session. Thus, the service cannot manipulate the drive mappings that are established within the user's other session(s).
    ...
    ...
    ...
    Redirected Drives on Microsoft Windows XP
    On Windows XP and on Microsoft Windows Server 2003, each logon session receives its own set of drive letters, A through Z. Therefore, redirected drives cannot be shared between processes that are running under different user accounts. Additionally, a service (or any process that is running in its own logon session) cannot access the drive letters that are established in a different logon session. However, drive letters that are mapped from a service that is running under the local System account are visible to all logon sessions.

    so, the only alternative is the plugin that gets run when MP starts up. i already have the code for mapping the drives here in visual c++ 6. it's just some lines, not really many. the only problem that keeps me from doing it is VS.NET and that i am going to vacation tomorrow for one week ;-)

    so, we have three options:
    1. when i come back, i'll get a license of VS.NET and write that thing by myself.
    2. somebody explains and tutors me how to do this with Visual Studio 6 and i'll do it when i come back (since MP is using .NET and managed c++ this is not really an option i guess)
    3. someone else writes it (and i send him my source code for this)

    your choice guys. since i have all my files on a network drive, i need such a solution.

    btw. instead of having a plugin that explicitely maps network drives, i think it would be even better to have a plugin that runs a specific program repetively or at least once at startup. this way you can write own apps that do those things like re-mapping of drives without the hazzle of writing plugins. maybe we should aim for that...

    EDIT
    besides that i think a 'startup plugin' (as i call it) might be useful, i think for fixing the network mapping problem, implementing network access directly in MP might be a better solution. so to speak, when defining music, movies and pictures folders, it would be good if you could also define network shares instead of only local drives and ftp servers (e.g. '192.168.0.1\\share1\\mp3'). what do you think?
     

    Inker

    Retired Team Member
  • Premium Supporter
  • December 6, 2004
    2,055
    318
    maybe I'm missing the point here, but if all you wanna do is acess your network shares from within mediaportal, then I dont see why you would need them connected as a networked drive.

    simply add the path to the network resource like you would any other folder (for example under music) like this: "\\192.168.0.2\sharedMusic"

    I do this and it works great.

    Hope I'm not completely missing your point

    Inker
     

    mikey79

    New Member
    September 30, 2005
    4
    0
    really?
    i remember using uncs or the ip and id didn't work. however, i am using samba on my fileserver and am not sure if it was a password / authentication problem here. as soon as i get back, i'll try it again. that would be great if it worked....
     

    mikey79

    New Member
    September 30, 2005
    4
    0
    no, this does not work. even when i map the drives and don't use MP as a shell, it doesn't work by nature because windows does not connect to those drives - that's where the tools come into play.
     

    Inker

    Retired Team Member
  • Premium Supporter
  • December 6, 2004
    2,055
    318
    ur right, if you require authentification then it wont work this way.

    sorry i guess
     

    Users who are viewing this thread

    Top Bottom