Page 1 of 1

Mapped drives on servers

Posted: Thu Apr 28, 2016 6:43 am
by ddedden
Is it possible to write a script to see what drives are mapped on each server. Would I use a powershell script to do so? What would this script look like?

--David

Re: Mapped drives on servers

Posted: Thu Apr 28, 2016 9:44 am
by hsmith
Are you running something like NSClient on the remote machine? NSClient can execute just about any remote remote script, and send the result back to your Nagios server.

I do not have a powershell script handy to provide you with, but maybe these links can help out:

http://superuser.com/questions/782863/l ... ell-script
http://techibee.com/powershell/powershe ... rives/1156
https://community.spiceworks.com/topic/ ... k-computer

If you get one of those working, check out this document for how-to on running scripts using NSClient.

Re: Mapped drives on servers

Posted: Thu Apr 28, 2016 7:25 pm
by Box293
This is quite a complicated topic.

Basically NSClient++ runs as the SYSTEM user.

Mapped drives are specific to the user that is logged on. Machines like Remote Desktop Session Hosts have many users logged in at any one time, all with their own mapped drives.

Can you explain perhaps why you want to see what drives are mapped, perhaps there is an easy solution once we know your end goal.

Re: Mapped drives on servers

Posted: Fri Apr 29, 2016 7:08 am
by ddedden
We have certain systems that use particular drives on the servers. If at any point there is a server that is down do to maintenance or what have you, and the mapping is lost, we need to know about it.

Re: Mapped drives on servers

Posted: Fri Apr 29, 2016 10:46 am
by WillemDH
This is a bit of a weird question. If the server is down to maintenance, you should know that with other checks? Do you mean a mapped network drive with "the mapping"? This would imply it is mapped with a user which is always logged in? Or you are using something like this? http://stackoverflow.com/questions/1827 ... 24#4763324

Re: Mapped drives on servers

Posted: Fri Apr 29, 2016 1:44 pm
by tmcdonald
@ddedden please provide some clarification about the above points, thanks!

Re: Mapped drives on servers

Posted: Wed May 18, 2016 6:42 am
by ddedden
@tmcdonald the servers that we run are windows 2008 R2 and 2012R2. We have services that run on these servers as well as scheduled tasks. The drives are mapped on the server, but I do not think they are user specific. There are two drives that are heavily used. We have a server team that does maintenance on all the servers monthly. For some reason these drives are dropped. We actually have a task we can run after the fact that will map the required drives. What I am seeking is to have a script on the servers that Nagios can execute and spit back to the GUI what drives are mapped on these servers after the scheduled maintenance so I don't have to log into every server and manually check the mappings.

Re: Mapped drives on servers

Posted: Wed May 18, 2016 12:21 pm
by hsmith
Have you checked any of the links that have been posted here?