list computer apppools


/ Published in: Visual Basic
Save to your folder(s)



Copy this code and paste it in your HTML
  1. resultPath = "c:\Scripts\Resultados\AppPools.txt"
  2.  
  3. set shell = WScript.CreateObject("WScript.Shell")
  4.  
  5. strComputer = shell.ExpandEnvironmentStrings("%ComputerName%")
  6. Set objWMIService = GetObject ("winmgmts:{authenticationLevel=pktPrivacy}\\" & strComputer & "\root\microsoftiisv2")
  7. Set colItems = objWMIService.ExecQuery ("Select * from IIsApplicationPoolSetting")
  8.  
  9. Dim fso, tf
  10. Set fso = CreateObject("Scripting.FileSystemObject")
  11. Set tf = fso.CreateTextFile(resultPath, True)
  12.  
  13.  
  14.  
  15.  
  16. For Each objItem in colItems
  17.  
  18. tf.WriteLine( VbCrLf & "--------------------------------------------------" & VbCrLf )
  19. tf.WriteLine("Name: " & objItem.Name)
  20.  
  21. Dim identidad,i
  22. i = objItem.AppPoolIdentityType
  23. Select Case i
  24. Case 0
  25. identidad = "Local System"
  26. Case 1
  27. identidad = "Local Service"
  28. Case 2
  29. identidad = "Network Service"
  30. Case 3
  31. identidad = objItem.WAMUserName
  32. Case 4
  33. identidad = "ApplicationPoolIdentity"
  34. End Select
  35.  
  36.  
  37. tf.WriteLine("Identidad: " & identidad)
  38. tf.WriteLine("WAM User Name: " & objItem.WAMUserName)
  39. tf.WriteLine("WAM User Password: " & objItem.WAMUserPass)
  40.  
  41. Next
  42.  
  43. tf.WriteLine( VbCrLf & "--------------------------------------------------")
  44. tf.Close
  45.  
  46.  
  47.  
  48. shell.Run "notepad " & resultPath

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.