473,671 Members | 2,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to access files' version numbers on remote servers -WMI, .Net

Hi

The only file information I need to access for a bunch of files (dlls &
exe) on several remote servers is "file version number". Using the code
below, I appear to be able to access all information (properties)
other than file version - using (System.Managem ent Namespace - WMI).
Can anyone assist me how to access file version. I see that for a local
PC, one can use the System.Diagnosi tcs.FileVersion Info class (rather
than simply the FileInfo Class which access most other file
information). This leads me to believe that using the CIM_DataFile
Class as per my code equates to using FileInfo class rather than an
equivalent WMI Class for FileVersionInfo .

I am not permitted to use mapped network drives and therefore I believe
that I cannot use the .Net Directory and FileVersionInfo classes to
interogate files in specific direcories on remote servers (Code Below -
aswell)?

//This is code to use for accessing files on Remote Server
string directoryName =
"D:\\Tutorial\\ Microsoft.Sdc.C onfiguration.Tu torial.Business \\bin\\Debug";
string sql = "ASSOCIATOR S OF " +
"{Win32_Directo ry='" + directoryName + "'} " +
"WHERE " +
"AssocClass=CIM _DirectoryConta insFile " +
"ResultClass=CI M_DataFile " +
"ResultRole=Par tComponent " +
"Role=GroupComp onent";

string computername = "RemoteTestServ er";
string path = "\\root\\cimv2" ;
ConnectionOptio ns oConn = new ConnectionOptio ns();
oConn.Username = "SomeUser";
oConn.Password = "SomePasswo rd";

ManagementScope scope = new System.Manageme nt.ManagementSc ope("\\\\" +
computername + path, oConn);
System.Manageme nt.RelatedObjec tQuery oQuery = new
System.Manageme nt.RelatedObjec tQuery(sql);
ManagementObjec tSearcher oSearcher = new
ManagementObjec tSearcher(scope , oQuery);
ManagementObjec tCollection oFiles = oSearcher.Get() ;

foreach(Managem entObject oFile in oFiles)
{
Console.WriteLi ne("File Caption: " +
Convert.ToStrin g(oFile["Caption"]));
Console.WriteLi ne("File Version: " +
Convert.ToStrin g(oFile["version"])); //DRATS ALWAYS NO VALUE!!!!!!!!!
Console.WriteLi ne("Archive: " + Convert.ToStrin g(oFile["Archive"]));
Console.WriteLi ne("Compressed : " +
Convert.ToStrin g(oFile["Compressed "]));
Console.WriteLi ne("File Name: " +
Convert.ToStrin g(oFile["FileName"]));
Console.WriteLi ne("File Extension: " +
Convert.ToStrin g(oFile["Extension"]));
Console.WriteLi ne("File Size: " +
Convert.ToStrin g(oFile["FileSize"]));
Console.WriteLi ne("File Type: " +
Convert.ToStrin g(oFile["FileType"]));
Console.WriteLi ne("Last Modified: " +
Convert.ToStrin g(oFile["LastModifi ed"]));
Console.WriteLi ne("File Size: " +
Convert.ToStrin g(oFile["FileSize"]));
Console.WriteLi ne("Name: " + Convert.ToStrin g(oFile["Name"]));
Console.WriteLi ne("Path: " + Convert.ToStrin g(oFile["Path"]));
Console.WriteLi ne("Name: " + Convert.ToStrin g(oFile["Name"]));
Console.WriteLi ne("System: " + Convert.ToStrin g(oFile["System"]));
Console.WriteLi ne("Manufaturer : " +
Convert.ToStrin g(oFile["Manufactur er"]));
}
//This is code to acces File version on local System
System.Diagnost ics.FileVersion Info flInfoVer =
System.Diagnost ics.FileVersion Info.GetVersion Info(stringFile Name);
version = flInfoVer.FileV ersion;

Thanks in advance.

Nov 1 '06 #1
0 1575

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1865
by: Todd Calhoun | last post by:
Hi, I've got a MySQL database being hosted by a company. The site has phpMyAdmin for external administration, but I'd like to use a program like EMS MySQL manager, or maybe even an OBDC connection for certain things. But I can't get the SSH tunnel to work. I can access the account using an SSH logon through putty, and once in, I can access MySQL using the terminal. But I can't get port forwarding to work.
6
4739
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
5
3688
by: premmehrotra | last post by:
I currently have a multi-user access database which is put on a shared drive L: on a Windows Servers. Entire database is one file premdb.mdb. Users access this database from their laptops. Following problems occur: 1. Access is way too slow in WAN environment. Server is located in New Jersey and users are in California and Puerto Rico. 2. Database often becomes corrupt 3. When one user updates some data in the database, other users...
6
3666
by: Terry Bell | last post by:
We've had a very large A97 app running fine for the last seven years. I've just converted to SQL Server backend, which is being tested, but meanwhile the JET based version, running under terminal server, has suddenly started running very slowly. The network engineer has thrown up his hands and said "It's Access 97". I've checked out lots of things including the Oplocks setting and other stuff from this NG, and I think I've done everything...
3
3489
by: Lyle Fairfield | last post by:
In a recent thread there has been discussion about Data Access Pages. It has been suggested that they are not permitted on many or most secure sites. Perhaps, that it is so, although I know of no site that has this prohibition, and I have uploaded DAPs to various sites and used them from those sites. I do not understand why any site manager would prohibit DAPs. To the best of my knowledge DAPs, as HTM files, are merely hosted on the...
0
3283
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere and VSS Remoting This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS Remoting and possible others.
17
2483
by: DaveG | last post by:
Hi all I am planning on writing a stock and accounts program for the family business, I understand this is likely to take close to 2 years to accomplish. The stock is likely to run into over a thousand items and the accounting side will be used for hopefully many years so the entries are likely to be vast. The delema is what is best to use ase the DB engine, Access I have as part of Office 2002 or should I really be looking at SQL...
7
2908
by: Allison | last post by:
Hi -- we are a small manufacturing looking for a multi-user database to take customer orders (nothing too complicated, with 3 users total). We think we should be using Access, but are wondering what alternatives there are. It has been recommended to us to use ASP.net and SQL instead, with the reasoning that: 1) Access is likely to go obsolete at some point 2) It will be more stable Does anybody have any thoughts on this?
15
4598
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never before needed to do this HTTP/XML/MySQL type functions.
25
2994
by: p byers | last post by:
Good Morning Folks I have a LAN Among the several connections to it are the following four devices: A MAXSTOR network Storage Device A PC running Microsoft Windows 2000 Server 5.0.2195 (SP4) A PC running Microsoft Windows XP Professional 5.1.2600 (SP2) A PC running Microsoft Windows XP Professional 5.1.2600 (SP2) All of the PCs are running IIS
0
8402
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8676
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6237
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5703
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.