Dedicated SQL Server Hosting Specialist Dedicated SQL Server Hosting Specialist

How To Restart DNS Service By VbScirpt?

                        


                      'Restart DNS
                      '-----------------------Stopping DNS----------------------------
                        Wscript.Echo("Stopping DNS........")
                        strComputer = "."
                        Set objWMIService = GetObject("winmgmts:" _
                            & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
                        Set colServiceList = objWMIService.ExecQuery("Associators of " _
                           & "{Win32_Service.Name='DNS'} Where " _
                                & "AssocClass=Win32_DependentService " & "Role=Antecedent" )
                        For each objService in colServiceList
                            objService.StopService()
                        Next
                        Wscript.Sleep 20000
                        Set colServiceList = objWMIService.ExecQuery _
                                ("Select * from Win32_Service where Name='DNS'")
                        For each objService in colServiceList
                            errReturn = objService.StopService()
                        Next

                        Wscript.Echo("DNS Stopped")

                        Wscript.Sleep 20000

                      '-----------------------Starting DNS----------------------------
                        Wscript.Echo("Starting DNS........")



                        strComputer = "."
                        Set objWMIService = GetObject("winmgmts:" _
                            & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
                        Set colServiceList = objWMIService.ExecQuery _
                            ("Select * from Win32_Service where Name='DNS'")
                        For each objService in colServiceList
                            errReturn = objService.StartService()
                        Next
                        Wscript.Sleep 20000
                        Set colServiceList = objWMIService.ExecQuery("Associators of " _
                           & "{Win32_Service.Name='DNS'} Where " _
                                & "AssocClass=Win32_DependentService " & "Role=Dependent" )
                        For each objService in colServiceList
                            objService.StartService()
                        Next


                        Wscript.Echo("DNS Started")



                        

Navigator

Other How-Tos
External Windows Resources
External SQL Server Resources
External Webmaster Resources
External Developer Resources

Questions?

Please email to webmaster[$]dedicatedsqlserver.com.

Lite SQL Server

CPU: Intel Core 2 Duo E6320
CPU Speed: 1.86GHz
Cache: 4MB
RAM: 1GB RAM
Disk: 2x160B SATA
RAID: RAID 1
Bandwidth: 1000GB
Win2008 Web or Win2003 STD: Free
IP Addresses: 8
Monthly: $119.00

Detail...

Standard SQL Server

CPU: Quad-Core Xeon E5410
CPU Speed: 2.33GHz
Cache: 12MB
RAM: 2GB RAM
Disk: 2x146GB SCSI
RAID: RAID 1
Bandwidth: 1500GB
Win2008 Web or Win2003 STD: Free
IP Addresses: 8
Monthly: $259.00

Detail...