How to logon to an NT Server

Hi everyone...

does sombody have an example how to logon to an NT Server? When I double click on an Server (Network Neighborhood) and I'm not in that domain, I will be asked for an username and password to access this server. How can I do this from within Delphi? I need to regulary access a server, but after every restart I have to logon manualy, which I would like to prevent :-)

Thanks, Jonny...
jonnyfiveAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
RBertoraConnect With a Mentor Commented:
I don't know how to do exactly what you want, but if you map a drive to that server you can effectively logon right:

here is how to map a drive:

To map to different PC harddrives use:

WNetAddConnection("\\Server\Path\", "pwd", "K:");

or WNetAdconnection2 :

procedure TForm1.Button1Click(Sender: TObject);
var
  Net : TNETRESOURCE;
begin

  with Net do
  begin
      dwScope := RESOURCE_CONNECTED ;
      dwType := RESOURCETYPE_DISK;
      dwDisplayType := RESOURCEDISPLAYTYPE_SHARE;
      dwUsage := RESOURCEUSAGE_CONNECTABLE;
      lpLocalName := 'K:';
      lpRemoteName := PChar('\\ntdata\foldername');
      lpComment := Pchar('None');
      lpProvider := Nil;
  end;

 WNetAddConnection2(Net,'Password','RBertora',CONNECT_UPDATE_PROFILE );

end;

Rob ;-)
0
 
RadlerCommented:
Well;

More points losted :-(

Your problem can be solved add a Trusted/Trusting Domain to/for your Local/Global Domain.

See yor User manager for domains at NT server and adjust like desired.

T++, Radler
0
 
jonnyfiveAuthor Commented:
Hi Radler...

I still have to review Robs solution (I will do this tommorow :-)... but a trust relation ship is not an option, since one is a coperate server which is controled by our IT department and the other one our local "staging" server. It's all about politics :-) But thanks anyway...

Regards, Jonny...
0
All Courses

From novice to tech pro — start learning today.