AutoHotkey Community

It is currently May 27th, 2012, 4:06 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Read Remote information
PostPosted: June 15th, 2011, 4:43 pm 
Offline

Joined: April 20th, 2006, 5:11 pm
Posts: 75
Location: Vienna
Hi!

I'm trying to write a Script to read and change some Data from local and remote computers aswell.

I found the scriptlets here: http://www.autohotkey.com/forum/topic65688.html

I changed them slightly so that ony infos that I need are read.

I need: Computername, Domain/Workgroup, Owner and Company to read and change.

I've written a little testscript to (first of all) read the data.

My problem is, while reading the data locally works fine, remote it doesn't work.
Mostly, I got the errors "RDP-Server not avaliable" or "Access Denied".


I'm not sure that it's the script or the connection.

Code:
strComputer := "andreas-netbook"
strNamespace := "\root\CIMV2"
strUser := "Administrator"
strPassword := ""

If strComputer in .,%A_ComputerName%
   {
   objWMIService := ComObjGet("winmgmts:{impersonationLevel=impersonate}!\\" strComputer strNamespace)
} Else {
   objSWbemLocator := ComObjCreate("WbemScripting.SWbemLocator")
   objWMIService := objSWbemLocator.ConnectServer(strComputer, strNamespace, strUser, strPassword)
   objWMIService.Security_.ImpersonationLevel := 3
   objWMIService.Security_.authenticationLevel := 6
}
colSettings := objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
for setting in colSettings {
   A_DomainName := setting.Domain
   A_IsDomain := setting.DomainRole
   Break
}

A_Owner := RegistryRead("HKLM", "SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOwner", strComputer)
A_Company := RegistryRead("HKLM", "SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", strComputer)

Msgbox, Owner: %A_Owner%`nFirma: %A_Company%`nDomain or Workgroup: %A_DomainName%`nIs in Domain: %A_IsDomain%
ExitApp

RegistryRead(RK, SK, V="", remote="") {
   remote := StrLen(remote) ? "\\" remote ":" : ""
   RegRead, Var, %remote%%RK%, %SK%, %V%
   Return, Var
}


* To test the script you may have to change the variables *

THXIA

EDIT: BTW: I'm using AHK_L v1.1.00.00


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Leef_me, rbrtryn and 61 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group