Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Wmi Connect As Another User
 

Vbscript / Operating System / Wmi Connect As Another User

Connect and perform WMI operations as another user.


strComputer = "server"
strUser = "domain\administrator"
strPassword = "123"

Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer,"root\cimv2", strUser, strPassword)

Set colSwbemObjectSet = objSWbemServices.ExecQuery("Select * From Win32_Process")
For Each objProcess in colSWbemObjectSet
    Wscript.Echo "Process Name: " & objProcess.Name
Next





Please note that a disclaimer applies to any code on this page.
 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
- Vbscript
     - Active Directory
     - Exchange
     - Files And Folders
     - General
     - Ms Office
     - Operating System
          - Add Remove Windows Server 2003 Components
          - Add Remove Windows Vista Components
          - Add Remove Windows Xp Components
          - Autologon And Runonce
          - Change Display Resolution
          - Change Location I386 Setup Files
          - Change Offline Folder Cache Location
          - Dell Bios Set Boot Device Order
          - Dell Bios Set Configuration Settings
          - Dell Bios View Configuration Settings
          - Dell Bios View Device Boot Order
          - Disable Vista User Account Control
          - Enumerate Cd Drives
          - Enumerate Computer Drives
          - Enumerate Disk Volumes
          - Enumerate Registry Keys
          - Flush Remote Dns Cache
          - Get Domain Name
          - Get Machine Hardware Model
          - Read Registry Key
          - Remotely Enable Remote Desktop
          - Rename Computer
          - Rename Dell Machine By Service Tag
          - Set Internet Explorer Homepage
          - Set Random Desktop Wallpaper On Startup
          - Set Vista Network Location Category
          - Start And Stop A Service
          - Vista Disable Ipv6
          - Windows Login Timer
          - Wmi Connect As Another User
     - Processes And Services
     - Text Processing
     - User Interaction
     - Web Servers