Link to home
Start Free TrialLog in
Avatar of kuzum
kuzum

asked on

marker script for identifiying disks

Hi Experts,

I have this script tested and works as expected.  script checks the disks attached to server and checks the  drive label  of the disks and create a .txt file with the drive letter name ( such as "D drive.txt")  scripts is copied to  each server already and locally run.

For an example, if four disk found as D, E,Y,S on a local server, after running the script,  when I  go into each disk, I should have a .txt file saved in there as D drive.txt, E drive.txt , Y drive.txt and S drive.txt

batch script will be used on  mixture Windows OS versions. ( 2003 to 2012)

Issue: it works fine when script is run locally but when needed to run using PSexec, it produces different issues  even though script is on the local server and all PSexec should do is executing the script with remotely instead of logging into the each server. I have read on forums that vmic is not very friendly with PSExec, is there way to eliminate wmic from the script? here is forum talks about the issues it causes:  https://forum.sysinternals.com/psexec-hangs-when-running-wmicexe_topic14752.html

thanks in Advance
markerfile.txt
Avatar of NVIT
NVIT
Flag of United States of America image

I haven't tested your script but... As an alternative, setup scheduled tasks on each server,which runs the script.
Avatar of kuzum
kuzum

ASKER

Point is that there should be no need to login servers to run script or schedule a scheduled task.
Hi,

What is it that you are trying to do with the script? I know create flag files but for what purpose?

Mike
Avatar of kuzum

ASKER

HI Mike T. purpose  of the script    is not related to what posted but as stated, as part of my work I would like to leave flag files as you said for each disk attached to server .im trying to achive this via script that works but needs tweaking to work without vmic
ASKER CERTIFIED SOLUTION
Avatar of Ben Personick (Previously QCubed)
Ben Personick (Previously QCubed)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
First I would avoid writing files to the root of the volumes as a general practise. It is not a good thing to do. If I could share the MS reference I would!
Second, it's going to be easier to use PowerShell to do this kind of thing. If all you want to do is "check the names and numbers of disks on a server" then you have two options:

1) use Powershell remoting to tell you the answer interactively
or
2) use Powershell remoting to return the answer as a scripted task

Yes, your script works but only locally. PS is more secure, more powerful and really the best way without using 3rd party tools.

Leaving flag files around the place is just going to force you to going and look directly at each server which is very labour intensive. If you are going to script it, script it so it's automated.

Mike
Avatar of kuzum

ASKER

thanks, exactly what I needed. thank for your responses everyone.
Hey Kuzum, glad to help meet your needs :)