By David Wiseman (Administrator)Created 16 Mar 2008
My Rating:
Vote
Rating:
Not Rated
Views:14873
Downloads:735

Ping All Computers in the Domain

Language:  VBScript

Compatibility

Windows XP Yes Windows 2003 Yes
Windows 2000 Unknown Windows NT Unknown
Vista Unknown Windows 2008 Unknown
Description

This script will ping all the computers in the current domain.


Notes
This script is designed to run in CSCRIPT mode. Run from a command prompt and type: CSCRIPT pingdomaincomputers.vbs If you would like to output the results to a text file, type: CSCRIPT pingdomaincomputers.vbs >>results.txt 
Code

Line Numbers: On  Off      Plain Text
OPTION Explicit
DIM cn,cmd,rs
DIM objRoot
DIM intFailed, intSucceeded
DIM strPing

set cmd = createobject("ADODB.Command")
set cn = createobject("ADODB.Connection")
set rs = createobject("ADODB.Recordset")

cn.open "Provider=ADsDSOObject;"
cmd.activeconnection = cn

' Used to get the default naming context. e.g. dc=wisesoft,dc=co,dc=uk
set objRoot = getobject("LDAP://RootDSE")

' Query for all computers in the domain
cmd.commandtext = "<LDAP://" & objRoot.get("defaultNamingContext") & ">;(objectCategory=Computer);" & _
		  "dnsHostName;subtree"
'**** Bypass 1000 record limitation ****
cmd.properties("page size")=1000

set rs = cmd.execute

intFailed = 0
intSucceeded = 0

' Ping all computers in the domain
while rs.eof <> true and rs.bof <> true
	strPing = ping(rs("dnsHostName"))
	IF LEFT(strPing,2) = "OK" then
		intSucceeded = intSucceeded + 1
	ELSE
		intFailed = intFailed + 1
	END IF

	wscript.echo rs("dnsHostName") & " : " & strPing
	rs.movenext
wend

cn.close

wscript.echo "Finished (" & intSucceeded & " Succeeded, " & intFailed & " Failed)"

' Function to ping a computer
private function ping(byval strComputer)
	DIM Status,objPing, ObjPingStatus
	status = "Error"
	Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
        		ExecQuery("select * from Win32_PingStatus where address = '" & _
            		strComputer & "'")
	For Each objPingStatus in objPing

        	If IsNull(objPingStatus.StatusCode) then
			status = "Failed"
		elseif objPingStatus.StatusCode<>0 Then 
			status = "Failed (" & getPingStatus(objPingStatus.StatusCode) & ")"
		else
			status = "OK (Bytes= " & objPingStatus.BufferSize & _
				", Time = " & objPingStatus.ResponseTime & _
				", TTL = " & objPingStatus.ResponseTimeToLive & ")"
        	End If
    	Next

	ping = status
end function

' Function to convert the status code into a useful description
private function getPingStatus(byval statusCode)
	DIM status
	status = statusCode
	SELECT CASE statusCode
		CASE 11001
 			status = "Buffer Too Small"
 		CASE 11002
			status = "Destination Net Unreachable"
 		CASE 11003
 			status = "Destination Host Unreachable"
 		CASE 11004
 			status = "Destination Protocol Unreachable"
 		CASE 11005
 			status = "Destination Port Unreachable"
 		CASE 11006
 			status = "No Resources"
 		CASE 11007
 			status = "Bad Option"
 		CASE 11008
			status = "Hardware Error"
 		CASE 11009
 			status = "Packet Too Big"
 		CASE 11010
 			status = "Request Timed Out"
 		CASE 11011
 			status = "Bad Request"
 		CASE 11012
			status = "Bad Route"
 		CASE 11013
 			status = "TimeToLive Expired Transit"
 		CASE 11014
 			status = "TimeToLive Expired Reassembly"
 		CASE 11015
 			status = "Parameter Problem"
 		CASE 11016
			status = "Source Quench"
 		CASE 11017
 			status = "Option Too Big"
 		CASE 11018
			status = "Bad Destination"
 		CASE 11032
			status = "Negotiating IPSEC"
 		CASE 11050
			status = "General Failure"
	END SELECT
	getPingStatus = status
end function
 

 


Got a useful script? Click here to upload!


 

  Post Comment
Order By:  
User Comments
      

Posted On: 9/4/2018 1:17:04 AM

hogan gucci shoes softball bats new balance calvin klein outlet boy london clothing hermes bags nike air max 2017 kevin durant jersey wedding dress oakley sunglasses omega watches jordan 14 michael jordan tommy hilfiger converse all stars abercrombie clarisonic mia kenzo clothing basketball jersey montre homme nike blazer polo lacoste pas cher nike air zoom pegasus adidas outlet armani handbags nike roshe nike outlet cartier sunglasses ralph lauren outlet ferragamo belt dior sunglasses nike pas cher mont blanc pens rolex watches air max 2018 chrome hearts jewelry nike free cheap wedding dresses jordan 10 vans scarpe prada sunglasses burberry outlet cheap oakley sunglasses new balance femme fossil handbags nike vapor max oakley sunglasses celine handbags michael kors outlet online dak prescott jersey nike air oakley glasses new balance trainer replica watches air max babyliss pro nano titanium christian louboutin shoes karen millen adidas outlet store basketball shoes herve leger dresses marc jacobs handbags armani sunglasses ferragamo sunglasses converse uk england world cup jersey jordan 3 new balance shoes hollister outlet nike free run spain world cup jersey christian louboutin gentle monster sunglasses dolce & gabbana saint laurent handbags longchamp pas cher vans pas cher polo ralph lauren adidas zx flux mont blanc pens bcbg max azria g-star jeans arcteryx jackets coach purse coach outlet miu miu shoes mizuno running shoes adidas outlet store jordan 8 tory burch nike outlet online oakley pas cher nike shoes polo ralph lauren instyler pandora uk bose headphones true religion jeans chopard jewelry adidas crazy giuseppe zanotti outlet timberland boots mizuno true religion isabel marant shoes kate spade uk kobe bryant shoes nike air max 97 chloe handbags hogan shoes argentina world cup jersey lululemon outlet bally shoes insanity workout adidas running shoes ralph lauren lunette ray ban ralph lauren outlet new balance shoes polo ralph lauren kevin durant shoes swarovski jewelry supra shoes jordan xx9 givenchy jewelry 10 deep clothing kobe 11 air force 1 dansko outlet hermes nike shoes jordan 3 iphone x case jordan 4 ray ban sunglasses jordan 2 pandora bracciali chanel outlet beats headphones givenchy handbags nike air max antonio brown jersey timberland pas cher kobe 9 elite jordan 12 furla handbags nike clothing softball bats karen millen fitflops oakley vault lacoste jeans skechers sneakers beats by dre adidas shoes montre pas cher jimmy choo sunglasses oakley uk ghd hair straighteners longchamp outlet germany world cup jersey new balance soldes tommy hilfiger pandora jewelry kd 9 ray ban nike uk michael kors true religion christian louboutin lebron shoes jordan nike air max 90 vans outlet puma shoes france world cup jersey michael kors uk cheap jerseys michael kors outlet polo ralph lauren tory burch outlet nike air max mizuno nike air max jordan 1 bathing ape clarks shoes barbour nike mercurial nike outlet jordan 32 ray ban pas cher basket nike polo ralph lauren air force one mac cosmetics online adidas outlet store cartier bracelet mac cosmetics kates pade outlet online roshe run hermes birkin jordan pandora charms kyrie 4 tods shoes chloe handbags tn pas cher nike outlet nike air max alife clothing kids jordans jordan 7 soccer jerseys parajumpers fitflops insanity workout christian louboutin pas cher cheap oakley sunglasses guess handbags nike air max jordan pas cher jordan 6 sac longchamp salomon shoes giannis antetokounmpo jersey nike roshe run christian louboutin mulberry longchamp handbags nike free swarovski gioielli timberland boots brazil world cup jersey air max 95 converse jordan replica watches ralph lauren bulgari jewelry nike air force 1 aaron rodgers jersey rolex watches kevin durant shoes james harden jersey huf clothing nike huarache nike canada ray ban sunglasses gucci outlet jordan 6 coach outlet online air max guess air jordan true religion outlet nike blazer prada pandora jewelry goyard handbags nike air max 2017 curry 4 guess factory champion clothing burberry sunglasses cheap jerseys harry winston jewelry chloe sunglasses lebron 11 designer sunglasses michael kors uk abercrombie bcbg dresses christian louboutin yeezy shoes reebok outlet jordan 9 nike air max 95 prada outlet dyson hair dryer tory burch nfl jerseys dolce & gabbana orologi rolex converse outlet store supra shoes insanity adidas superstar bottega veneta sunglasses nike roshe gucci handbags converse shoes fendi sunglasses balenciaga sneakers true religion outlet burberry sale lululemon outlet nike air max ray ban sunglasses burberry beats headphones nike air max hermes bags nike blazer nike mercurial nike roshe run adidas trainers uk bottega veneta iphone cases lebron shoes cheap jordans toms outlet abercrombie adidas slides keen sandals nike outlet store guess canada burberry abercrombie and fitch carrera sunglasses michael kors outlet sac michael kors portugal world cup jersey fitflops outlet oakley sunglasses ai max ray ban sunglasses michael jordan nike mercurial superfly adidas soccer air max 90 occhiali oakley jordan 4 ferragamo lacoste shoes replica watches red bottom shoes prada handbags adidas soccer cleats chrome hearts jewelry michael kors outlet tiffany jewelry converse chuck taylor nfl jerseys asics gel adidas outlet store nike roshe jordan 5 chaussure nike longchamp bottega veneta coach factory outlet dsquared2 jeans salvatore ferragamo chi flat iron jordan shoes toms shoes ed hardy ferragamo marc jacobs handbags dolce & gabbana sunglasses michael kors canada gucci outlet sac vanessa bruno jordan lunette oakley kristaps porzingis jersey reebok shoes ghd flat iron barbour jackets cheap jordan shoes scarpe hogan chanel handbags belgium world cup jerseys manolo blahnik shoes swarovski crystal nike foamposite alexander mcqueen handbags air max 90 jimmy choo furla handbags hollister air more uptempo kate spade dansko shoes cheap wedding dresses nike free ray ban sunglasses dsquared2 outlet kyrie irving jersey michael kors handbags freshjive clothing golden goose sneakers nike roshe run air max plus ray ban occhiali prom dresses kd 10 longchamp handbags vibram fivefingers ferragamo shoes louboutin pas cher michael kors handbags carson wentz jersey dolce & gabbana adidas originals tommy hilfiger pas cher nike free run diesel jeans burberry outlet versace handbags converse curry 3 ray ban jordan clothing hermes jewelry bvlgari sunglasses armani jeans nike free run reebok shoes flip flops asics gel vans outlet chanel outlet true religion jeans curry 5 nike factory ferragamo shoes dior bags nike air max 90 valentino fendi handbags calvin klein jeans asics running shoes gucci belt nike store kobe 12 jordan 31 ai max adidas flip-flops beats pill links of london uk burberry clothing pandora bijoux oakley sunglasses marc jacobs handbags air max 90 adidas superstar stuart weitzman shoes nike kyrie 2 michael kors asics trainers jordan 13 mac makeup air jordan nike shoes curry 2 jbl headphones ghd fendi basket store louboutin outlet stuart weitzman jimmy choo shoes jordan 11 sac michael kors burberry handbags kobe 10 balmain jeans montres pandora charms bape clothing jordans mac makeup michael jordan adidas clothing longchamp outlet bijoux swarovski michael kors outlet michael kors 2018.9.4xukaimin

xiaoou
Posted On: 11/15/2018 9:54:51 AM

ralph lauren adidas originals supreme uk polo outlet shoe carnival canada goose jackets snapback hats nike hyperdunk cheap nfl jerseys ralph lauren canada goose jackets tods shoes true religion jeans marc jacobs handbags north face ugg outlet air max 1 nike uk skechers sandals adidas superstar air jordan vetements clothing prada sunglasses yoga pants cheap mlb jerseys reebok shoes nike outlet baseball jersey cheap nfl jerseys wholesale hats jordans hollister outlet nine west shoes ugg boots bottega veneta scarpe mbt nike sb manchester united jersey philipp plein outlet jordan pas cher jordans michael kors handbags north face outlet valentino shoes saucony running shoes swarovski rings nfl jerseys versace clothing van cleef & arpels jewelry mcm bags nike flip-flops vans outlet coach outlet online valentino shoes coach purse vans shoes fingerlings monkey nike outlet coach outlet online adidas nmd ray ban sunglasses ralph lauren air jordan 3 timberland outlet basketball shoes cristiano ronaldo jersey polo ralph lauren christian louboutin shoes supreme clothing air jordan adidas shoes birkenstock sandals herve leger dresses puma slides nike blazer longchamp handbags michael kors handbags true religion jeans adidas outlet canada goose outlet ray ban sunglasses tiffany jewelry moncler jackets fila shoes canada goose outlet tiffany jewelry ugg boots maillot de foot oakley canada ralph lauren polo shirts prada handbags ralph lauren jimmy choo cheap nba jerseys breguet watches philipp plein outlet nike air huarache adidas yeezy rayban air max uggs outlet flipflops russell westbrook shoes burberry outlet store miu miu sunglasses givenchy handbags michael kors outlet clearance hermes belt polo ralph lauren uggs outlet christian louboutin shoes tag heuer watches oakley sunglasses air max 97 ralph lauren nike shox kd 10 belstaff jackets harden vol 2 louboutin shoes tom brady jersey russell wilson jersey ugg outlet arc'teryx clothing kobe shoes sophia webster shoes cheap mlb jerseys puma outlet fitflops oakley vault ugg boots yeezy 500 adidas ultra boost lebron 15 hermes bags wholesale nfl jerseys salvatore ferragamo shoes coach outlet undefeated shoes hermes bags michael kors taschen air max 2017 marcelo burlon coach outlet online jordans birkenstock sandals kate spade handbags red bottoms montblanc adidas football boots mac makeup supreme clothing nike air force visconti pens fitflop pandora jewelry ugg shoes dansko shoes miu miu shoes ??? ????? pelikan pens moncler outlet nfl jerseys wholesale timberland boots kate spade longchamp vendita maglie calcio tom ford sunglasses ralph lauren ralph lauren jeans pandora charms ugg sale air max plus louboutin outlet ugg boots soccer jerseys soldier 9 asics running shoes burberry handbags tory burch swarovski crystal malone souliers shoes supra shoes ugg outlet vans shoes ugg for men new balance shoes stuart weitzman shoes new balance oakley sunglasses maillot de foot soldier 10 christian louboutin supreme nike outlet store nike outlet nike free ray ban sunglasses pandora jewelry kyrie 2 coach outlet store coach factory outlet timberland ugg sale ugg outlet hermes belt coach outlet online coach outlet christian louboutin outlet oakley sunglasses nike factory nicholas kirkwood shoes pandora jewelry air jordan 11 mulberry handbags kd shoes bcbg dresses polo ralph lauren victoria's secret outlet cheap oakley sunglasses ysl handbags giuseppe zanotti shoes air max jordan 8 coach outlet ugg boots ugg boots kate spade nike mercurial superfly polo ralph lauren north face jackets converse shoes timberland boots jordan 5 ray ban sunglasses nike free run air jordan ugg outlet ugg sale ugg factory outlet rolex watches michael kors outlet ugg boots pandora charms mikimoto jewelry timberland boots russell westbrook jersey canada goose sale nfl jerseys uggs x-large clothing omega watches fitflops sale clearance ralph lauren ugg boots coach factory outlet mk purse coach factory outlet online Fußballtrikots günstig adidas jeremy scott supreme paris cheap soccer jerseys adidas nmd kate spade outlet ugg outlet ugg sale longchamp outlet flip-flops moncler outlet air jordan baseball bats ray bans nike revolution kobe 11 off-white tory burch sandals air jordan pandora charms fitflop onitsuka tiger superdry kd 8 pasotti ombrelli moncler jackets mont blanc pens ferragamo outlet ambassador 10 kate spade light up shoes christian louboutin shoes nike air max coach factory outlet ugg outlet persol sunglasses ralph lauren balenciaga triple s coach handbags ralph lauren nike air max cheap nfl jerseys adidas yeezy mishka clothing ray ban sunglasses ugg boots baby uggs flops lee jeans nhl jerseys basketball shoes prada puma fenty ugg outlet store nfl jerseys mizuno running shoes cheap nfl jerseys ugg australia beats by dre michael kors outlet moose knuckles jackets hermes belt coach outlet michael kors handbags columbia sportswear spalding basketball nike free run true religion jeans air max 270 michael kors outlet online michael kors outlet nike huarache north face outlet ralph lauren ray ban nike outlet nfl jerseys ugg outlet nike outlet breitling watches coach handbags moncler outlet nike socks longchamp handbags bvlgari rings ugg australia coach outlet canada goose outlet suicoke ronaldo jersey paul george shoes coach handbags kate spade handbags michael kors handbags canada goose jackets michael kors outlet clearance michael kors outlet clearance oakley sunglasses nike kyrie 3 ray ban versace bags christian louboutin moncler outlet jordan 4 mcm handbags camisetas fútbol jordan 12 converse hundreds clothing linda farrow sunglasses soldier 11 oakley sunglasses cheap pandora jewelry hogan outlet ugg outlet coach outlet online juicy couture air max 95 lebron 14 oakley sunglasses jordan 6 ralph lauren mbt shoes air max 90 jordan retro michael kors handbags canada goose jackets ralph lauren longchamp handbags manolo blahnik birkenstock sandals burberry outlet louboutin converse shoes soccer jersey mac cosmetics nike epic react flyknit barcelona jersey ray ban sunglasses ugg boots for men ray ban sunglasses nike cortez maglie calcio jimmy choo nobis jackets coach factory online burberry canada ugg clearance prada outlet online marc jacobs bags jordan xx9 nike shoes for men levi's jeans moncler outlet air max adidas wings montblanc pen ugg boots alexander mcqueen shoes tommy hilfiger polo shirts nike dunks ugg for women lululemon cartier jewelry ugg boots nike flight bonafide north face jackets jordan shoes omega watches columbia outlet wedding shoes air jordan 14 vans shoes audemars piguet tiffany bracelet prada handbags ugg sale adidas slides ray ban sunglasses nike lunarglide ferragamo shoes cheap nhl jerseys michael kors handbags ralph lauren uk y-3 shoes adidas outlet store michael kors uk nike tn canada goose jackets mac cosmetics ugg for kids replica watches coach outlet online new balance sandals lebron 13 nike outlet oakley sunglasses curry jersey tory burch outlet fußballtrikots ermäßigung tory burch shoes cheap mlb jerseys coach outlet online ugg outlet michael kors handbags soccer jerseys christian louboutin maui jim sunglasses christian louboutin air jordan monster headphones hermes birkin bag air force 1 nike running shoes coach outlet air max 2018 adidas flip flops balenciaga sandals michael kors outlet clearance ysl sunglasses under armour outlet jordan shoes tory burch bags parajumpers jackets north face outlet harden vol 1 nike roshe canada goose jackets lebron 15 cheap replica watches nfl jerseys kate spade purse oakley sunglasses wholesale nike factory ray ban canada goose outlet pandora jewelry canada ugg outlet nike roshe canada goose outlet true religion jeans dior handbags flip flops jordan shoes pandora jewelry canada air max ugg slippers adidas uk hermes outlet jordan 1 adidas outlet birkenstock outlet nike tennis converse shoes ugg boots longchamp outlet the north face ray ban kate spade outlet curry shoes soccer shirts camisetas de futbol baratas north face outlet tiffany jewelry ray bans dolce & gabbana under armour shoes balenciaga shoes supra shoes true religion uggs on sale ugg clearance moncler outlet christian louboutin longchamp handbags lululemon sale air max woolrich jackets versace sunglasses manolo blahnik ugg boots michael kors handbags adidas outlet nike presto canada goose coats christian louboutin michael kors outlet off-white shoes north face outlet vibram fivefingers nike dunks links of london coach outlet true religion jeans lebron james jersey coach outlet ray ban outlet stussy hoodie vapormax swarovski jewelry fjallraven kanken polo outlet coach outlet north face outlet yeezy shoes nike blazer ugg outlet coach handbags outlet cheap jordan shoes nike shoes teva sandals michael kors bags stan smith ysl makeup canada goose jackets police sunglasses celine outlet running shoes nike outlet store online 201811.15wengdongdong

phamyen
Posted On: 12/10/2019 1:58:09 AM

This is really great work return man 3 .Thank you for sharing such a useful information here in the blog