Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a situation where I need to boot a VM into normal mode but disable as many services as possible. Basically we are doing a virtual to virtual conversion of the VM and the fewer services running, the less likely that a file will be locked and unable to be copied.

The conversion program (Citrix XenConvert) uses VSS to take a snapshot but still files are sometimes skipped because they are open.

I know the obvious question is "why not boot into safe mode with networking" - unfortunately, if I do that, it messes with the virtualization tools.

Ideally it would be a script that gets the vendor of every service that is running, and if the vendor is NOT microsoft, it stops the service. Even better would be an exclusion list, so that I could say "don't stop this vendor's services".

Do you incredibly smart and resourceful people have any idea where that script could be found? Or cobbled together quickly?

Many thanks!

share|improve this question
    
Which version of Windows is the VM running? Do you have access to PowerShell on this machine? I certainly could harvest the list of services that run in Safe Mode and then write a script that would attempt to stop anything that's not on the list. It wouldn't be foolproof, because some services (e.g. antivirus programs) don't necessarily stop when asked, but it would do 95% of what you're asking. –  Skyhawk Sep 30 '10 at 23:53
    
Miles - These VMs are going to be Windows 2003 primarily, a few 2008. One is Win2k but we don't need to worry about it. I do not have powershell across every single machine. However what you are describing sounds great, especially since it's a "stop everything but these safe mode services" opposed to "go thru this giant list of services and try to stop them whether they exist or not"! I would very much appreciate anything you can do. –  Jeremy Oct 1 '10 at 18:27

1 Answer 1

up vote 1 down vote accepted

Think you'll have to put together a list of services you want to stop manually, then create a batch file to stop /start them.

Typing

net start 

at a command prompt will return a list of running services.

net help services 

will give you the basic windows services, though some of these can be stopped and there will likely be others in the list from net start that you won't want to stop. I suggest you experiment with a little trial and error.

Once you have the list of service names you wish to stop, create a .bat file with the following line repeated for every service you want to stop enclosed in quotes:

NET STOP "Service Name"

Create another .bat file with each service to start again when you're through:

NET START "Service Name" 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.