PowerShell Script unmounting All mounted images

1

Just started using PowerShell Script.

I have created scripts for my kids, that Mount a diskimage and then runs the executable for that game.

Is there a way to make a a script to be run at logoff that will dismount all mounted image files?

Thanks in advance

user706438

Posted 2017-03-11T13:35:50.247

Reputation: 11

Question was closed 2017-03-22T00:54:54.573

Please note that https://superuser.com is not a free script/code writing service. If you tell us what you have tried so far (include the scripts/code you are already using) and where you are stuck then we can try to help with specific problems. You should also read How do I ask a good question?.

– DavidPostill – 2017-03-11T13:49:35.957

It was more in the way to hear if it would be possible to do it? – user706438 – 2017-03-11T14:34:47.547

If you can mount them you can unmount them. You can run a script at logoff. Search for "windows run script at logoff" – DavidPostill – 2017-03-11T14:42:02.490

Answers

0

There sure is. The command is dismount-diskimage.

Here's the full Technet site for this command: https://technet.microsoft.com/en-us/library/hh848693(v=wps.630).aspx

But the basics are that you just need to pass it the path of the image you've mounted that you wish to dismount. You could probably have a script poll for any mounted images and pass the results along to this command.

music2myear

Posted 2017-03-11T13:35:50.247

Reputation: 34 957