473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading Restored WMI Files

1 New Member
Im wondering if anyone has come across a way of reading EventLogs using WMI. The event logs files are restored from another server.
Below is the C# class that executes the query.
NOTE : The event logs were created on a different (production) machine that I dont have access to. Is it possible to read these files viia WMI ?


ManagementObjec tSearcher searcher = null;
//Maybe add the namespace as a parameter in the future
string sNameSpace = "root\\cimv 2";

EventList foundentries = new EventList();

System.Manageme nt.ManagementSc ope oMs = new System.Manageme nt.ManagementSc ope("\\\\" + sMachineName + "\\" + sNameSpace);

// Although connection information is not used in this example, I'll show you how to construct it here
//Connection credentials to the remote computer - not needed if the logged in account has access
ConnectionOptio ns oConn = new ConnectionOptio ns();
oConn.Username = sUserName;
oConn.Password = sPassword;
oConn.Impersona tion = ImpersonationLe vel.Impersonate ;
oMs.Connect();
searcher = new ManagementObjec tSearcher(sWMIQ uery);
searcher.Get();
searcher.Scope = oMs;


int counter = 0;

//returns the records
foreach (ManagementObje ct Event in searcher.Get())
{
Sep 12 '07 #1
1 1398
bartonc
6,596 Recognized Expert Expert
I'm actually a python guy, myself, but I've recently found Scriptomatic 2.0 in order to try to get a handle on WMI.

Of course, there is always our .NET Forum where there are (no doubt) plenty of experts fielding C# quesstions.
Sep 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3233
by: Jol | last post by:
This is more of a fyi than a question. After restoring a live db backup to our development server there was an identically named login Melb02 on both the db server and in the restored db backup. However if you log in as Melb02 on the server you cannot access any objects owned by Melb02 on the restored db, without putting...
2
2152
by: Burkhard Schultheis | last post by:
We have some problems with DB2 V8 on Linux. DB2 showed SQL 1042. So we restored the last online backup successfully. But because there are only 2 log files rollforward is not possible. Is it possible to tell db2 that it should forget about the rollforward pending (not to care about inconsistency)? Regards, -- Burkhard Schultheis Tele...
2
5796
by: Dan | last post by:
Hello, I am just now converting from the world of DOS. Making simple VB.NET apps was easier than I expected. Now I need some control over the window that the app is running in. Can a VB.NET application run some code when its window is closed/ minimized / restored /maximized / moved / resized ? ( and how of cource ) Can a VB.NET app...
2
3900
by: Raymond Du | last post by:
Hi, I am working on a VB.Net window application, the application use System.IO.File.Delete method to delete files, can those deleted files be restored? TIA
2
3238
by: nnimod | last post by:
Hi. I'm having trouble reading some unicode files. Basically, I have to parse certain files. Some of those files are being input in Japanese, Chinese etc. The easiest way, I figured, to distinguish between plain ASCII files I receive and the Unicode ones would be to check if the first two bytes read 0xFFFE. But nothing I do seems to be able...
0
3785
by: Parv | last post by:
hi all can i attach a read only restored database. I restored a database Test in Stand by Mode. After that i detached that database and while restoring i m getting msg "Cannot attach a database that was being restored.". Is it o that i can not attach a readonly restored detached database ? Parveen Beniwal
1
2316
by: Roy | last post by:
Hi, Thanks for helping.I have an A2K Appl.Recently,one of the groups agreed to provide data which I download into the access table.The problem is this data which is sent in a text file.I am unable to import it because of the delimiter tab.The tab is present in places where it is unable to identify one problem ID from the second one.I need...
1
1382
by: Query Builder | last post by:
Hi All, I have to a few backups restored from a set of backup files. The backup files have been removed from the drive because of some storage constrains... For some data comparison reasons, I need to figure out the actual date of these backup files that is used to restore these databases. Is there any system table I can query to figure...
0
2143
by: Miaaa Mukherjee | last post by:
Friends , I have a one folder named FY07 which contains a zip file of 33,408KB. In that zip file it contains a .BAK file type of size 153,507,328 of 78% Ratio. Now, my problem is that i want to restore the .BAK extension file which contains the database details in it. I want to know how can i restore and open and read the...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.