TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ken
NA
110
0
Reading WMI properties remotely?
Jul 5 2011 2:39 PM
Hi. I'm trying to read some WMI properties to collect hardware data of a remote machine. Problem is, it runs w/o error but tells me my local machine hardware instead. I'm sure I just made some silly mistake, but I don't see it:
ConnectionOptions co = new ConnectionOptions();
co.Username = null;
ManagementScope ms = new ManagementScope("\\\\remotepcname", co);
ObjectQuery q = new ObjectQuery("select * from Win32_PointingDevice");
using (ManagementObjectSearcher os = new ManagementObjectSearcher(ms, q)) {
using (ManagementObjectCollection moc = os.Get()) {
foreach (ManagementObject o in moc) {
MessageBox.Show("Mouse: " + o["Name"].ToString());
}
}
}
I tried changing the co.Username = null to:
co.Username = "domain\\user";
co.Password = "pwd";
but that threw an exception that it cannot be done on local connections.
??
Reply
Answers (
1
)
How I can add Open/Save or other menu item to PrintPreview form (dialog)?
Collectionbase class