Created
September 17, 2009 19:11
-
-
Save jasonlyles/188663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'win32ole' | |
#PUTS-ing Route table | |
ole = WIN32OLE.connect("winmgmts://") | |
query = "select * from Win32_IP4RouteTable" | |
puts "Network Address\t\tNetmask\t\tGateway Address\t\tMetric" | |
ole.ExecQuery(query).each do |route| | |
puts "#{route.Destination}\t\t#{route.Mask}\t\t#{route.NextHop}\t\t#{route.Metric1}" | |
end | |
#PUTS-ing ipconfig type stuff | |
query = "select * from Win32_NetworkAdapterConfiguration where IPEnabled = True" | |
ole.ExecQuery(query).each do |nic| | |
puts nic.IpAddress | |
puts nic.IpSubnet | |
puts nic.DefaultIPGateway | |
puts nic.DNSHostName | |
end | |
#PUTS-ing Registry entries | |
obj = WIN32OLE.new('WScript.Shell') | |
path = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Path\\To\\Where\\U\\Want\\2\\B\\" | |
ubd_key = "UserBaseDir" | |
sql_connect_key = "SQLConnectString" | |
crlbd_key = "CRLBaseDir" | |
a = [ubd_key, sql_connect_key, crlbd_key] | |
a.each do |key| | |
puts obj.RegRead("#{path}#{key}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment