title: objShell.Run MailTo populate vars
body: <p>I have a script I’m trying to run that will grab the IP address and Computer name and popup their default mail client.  I can’t figure out how to have the mailto grab the variables..  Any help would be much appreciated! </p>
  
  <pre><code>    Set objShell = CreateObject("Wscript.Shell") 
  
      Set objEnv = objShell.Environment("Process") 
      strComputer = objEnv("COMPUTERNAME") 
      strUser = "Scanner.User" 
      strPass = "SomePassword" 
  
      Set colAccounts = GetObject("WinNT://" &amp; strComputer &amp; ",computer") 
  
      Set objUser = colAccounts.Create("user", strUser) 
  
      objUser.SetPassword strPass 
  
      Const ADS_UF_DONT_EXPIRE_PASSWD = &amp;h10000 
      objPasswordExpirationFlag = ADS_UF_DONT_EXPIRE_PASSWD 
      objUser.Put "userFlags", objPasswordExpirationFlag 
  
      objUser.SetInfo 
  
      Set Group = GetObject("WinNT://" &amp; strComputer &amp; "/Administrators,group") 
      Group.Add(objUser.ADspath) 
  
      temp = "select IPAddress from Win32_NetworkAdapterConfiguration "&amp; _ 
      "where IPEnabled=TRUE" 
  
      temp2 = "winmgmts:{impersonationLevel=impersonate}" 
  
      set IPConfigSet = GetObject(temp2).ExecQuery(temp) 
  
      for each IPConfig in IPConfigSet 
       if Not IsNull(IPConfig.IPAddress) then 
          for i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress) 
  
              objShell.Run("mailto:MyEmail@address.com&amp;subject=strComputer&amp;body=IPConfig.IPAddress(i)") 
             Msgbox IPConfig.IPAddress(i) 
          next 
       end if 
      next 
  </code></pre>