oscar
(Fresh Scripter)
2005-07-28 05:44 AM
script to map to network drive

Ok, im sure everyone has mapped to a network drive before.
I only know of 2 ways to do this.

1. Through "my computer", click map network drive.
2. through the start menu: click run, type--> \\"computer name"\c$

Can anyone tell me how to write a script to do the second one.
If not, how about the first .
Thanks


NTDOCAdministrator
(KiX Master)
2005-07-28 05:56 AM
Re: script to map to network drive

Hello and welcome to the board

Using KiXtart



USE G: '\\SERVER\SHARE'

 
That's all there is to it.

If you want to be group conditional about it then like this.

If InGroup('MyDomain\MyGroup')
 USE G: '\\SERVER\SHARE'
EndIf
 


Bryce
(KiX Supporter)
2005-07-28 05:57 AM
Re: script to map to network drive

from a command prompt
net use * \\server\sahre

or, kix code

Code:

use * "\\server\share"



Might want to take a gander manual.


oscar
(Fresh Scripter)
2005-07-28 06:16 AM
Re: script to map to network drive

u guys rock, thanks , ill try it out tomorrow.

Kdyer
(KiX Supporter)
2005-07-28 05:27 PM
Re: script to map to network drive

One thing to keep in mind, however:
Code:

\\"computer name"\c$



Any of the c$, d$, admin$, etc. are all Administrative Shares and common users cannot map drives to them.


oscar
(Fresh Scripter)
2005-07-29 03:53 AM
Re: script to map to network drive

anyone know how to logoff a remote machine?
i tried and logged myself off. i used: $RC = LOGOFF(1)
?????


Richard H.Administrator
(KiX Supporter)
2005-07-29 12:44 PM
Re: script to map to network drive

You could try Shutdown() with the reboot option.

Kdyer
(KiX Supporter)
2005-07-30 01:09 AM
Re: script to map to network drive

Couple of things to try..

Install the ADMINPAK.MSI from one of your DCs and use "Terminal Services Manager" from Administrative Tools in your Control Panel to connect to any system and choose logoff. If logoff doesn't work, choose reset.

You can also use Hyena (Shareware) to do the same thing.

HTH,

Kent


Les
(KiX Master)
2005-07-30 03:05 AM
Re: script to map to network drive

AFAIK, Hyena is not shareware and must be licensed.

NTDOCAdministrator
(KiX Master)
2005-07-30 03:44 AM
Re: script to map to network drive

Can you say FREEWARE
 
Quote:

PsShutdown is a command-line utility similar to the shutdown utility from the Windows 2000 Resource Kit, but with the ability to do much more. In addition to supporting the same options for shutting down or rebooting the local or a remote computer, PsShutdown can logoff the console user or lock the console (locking requires Windows 2000 or higher). PsShutdown requires no manual installation of client software.






PsShutdown

 
Installation
Just copy PsShutdown onto your executable path, and type psshutdown with command-line options defined below.

PsShutdown works on NT 4.0 and higher.

Usage
You can use PsShutdown to initiate a shutdown of the local or a remote computer, logoff a user, lock a system, or to abort an imminent shutdown.

usage: psshutdown [[\\computer[,computer[,..] | @file [-u user [-p psswd]]] -s|-r|-h|-d|-k|-a|-l|-o [-f] [-c] [-t nn|h:m] [-n s] [-e [u|p]:xx:yy] [-m "message"]

For the entire suite of PsTools check them out here
PsTools
 
Quote:

The tools included in the PsTools suite, which are downloadable individually or as a package, are:

PsExec - execute processes remotely
PsFile - shows files opened remotely
PsGetSid - display the SID of a computer or a user
PsKill - kill processes by name or process ID
PsInfo - list information about a system
PsList - list detailed information about processes
PsLoggedOn - see who's logged on locally and via resource sharing (full source is included)
PsLogList - dump event log records
PsPasswd - changes account passwords
PsService - view and control services
PsShutdown - shuts down and optionally reboots a computer
PsSuspend - suspends processes
PsUptime - shows you how long a system has been running since its last reboot (PsUptime's functionality has been incorporated into PsInfo)
All of the utilities in the PsTools suite work on Windows NT, Windows 2000, Windows XP and Windows Server 2003. The PsTools download package includes an HTML help file with complete usage information for all the tools.





 


LonkeroAdministrator
(KiX Master Guru)
2005-07-31 04:50 PM
Re: script to map to network drive

hyena is shareware.

oscar
(Fresh Scripter)
2005-08-02 01:23 AM
Re: script to map to network drive

thanks for all the info, it's really helping