Update VBScript to work with Windows 7 -


i running windows xp pro on domain computers , in process of migrating windows 7.

i have schedule task runs vb script @ login assigns partition current user.

here breakdown of setup,

   -80 gb hard drive    -30 gb system partition    -10 gb partition (dmw drive)    -10 gb partition (dth drive)     -10 gb partition (nmw drive)    -10 gb partition (nth drive) 

the script assigns correct drive according time of login. use have storage place users have full access save data.

this runs on xp not run on windows 7.

here script.

set wshshell = wscript.createobject("wscript.shell")     ireturn = wshshell.run("diskpart.exe /s removeall.txt", 1, true) set objwmiservice = getobject("winmgmts:\\.\root\cimv2") set colitems = objwmiservice.execquery("select * win32_localtime", , 48) each objitem in colitems     dayofweek = objitem.dayofweek     hourofday = objitem.hour next     if dayofweek = 1 or dayofweek = 3         if hourofday >= 6 , hourofday <= 13             ireturn = wshshell.run("diskpart.exe /s aset.txt", 1, true)         end if         if hourofday >= 15 , hourofday <= 22             ireturn = wshshell.run("diskpart.exe /s cset.txt", 1, true)         end if     end if     if dayofweek = 2 or dayofweek = 4         if hourofday >= 6 , hourofday <= 13             ireturn = wshshell.run("diskpart.exe /s bset.txt", 1, true)         end if         if hourofday >= 15 , hourofday <= 22             ireturn = wshshell.run("diskpart.exe /s dset.txt", 1, true)         end if     end if 

here text files script calls on.

aset.txt = select volume 2        assign bset.txt = select volume 3        assign cset.txt = select volume 4        assign dset.txt = select volume 5        assign  removeall.txt =                select volume 2               remove noerr               select volume 3               remove noerr               select volume 4               remove noerr               select volume 5               remove noerr 

any input appreciated.

thank you.

since diskpart requires elevation, need configure scheduled task run elevated ("run highest privileges" on general tab of task properties).


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -