I need to get information about the product of a process.
As an example, I need to know whether the process WINWORD belongs to Office 2010 or Office 2013. Another example would be with the software of adobe creative suite.
In general for a process, which name can be the same for different suites, how to find out the suite version.
In a service I have a list of process names, retrieved from a server. I track for how long a user has been using these process and send this info back to the server. Because the service will be installed in several computers, the Office suite, the Adobe suite or any other product, may be different, but the process is likely to be named the same in each suite.
Currently, in the server I have no way to identify to which version the process belongs to. It a requierement to be able to show for how long, for example, Microsoft Word 2010 has been used and so for each version
I hope I'm being clear.
Thanks #Niels for your contribution, which is to retrieve a process MajorPart from it's FileVersionInfo.
We can send this info as an addition. Surely it makes it simple to identify a suites like Office, where all the products versions major part are the same, butt...
With the adobe list you've showed me that in a adobe suite most products will have a different mayor versions and that's what we're affraid of with checking a process FileVersionInfo. Having to setup in the server a way to link each product's major version with the suite just for adobe, means that such thing has to be done for each software in the same or similar situation.
You can look into the file properties, as also exposed by Explorer:
To retrieve this data in .NET you inspect a FileVersionInfo instance as returned by FileVersionInfo.GetVersionInfo. Samples are provided on both help pages, but the easiest would be for your case as you're only interested in the major version numbers:
// Get the file version for the notepad.
FileVersionInfo myFileVersionInfo =
FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\\Notepad.exe");
// Print the product major part number.
textBox1.Text = "Product major part number: " + myFileVersionInfo.ProductMajorPart;
Build numbers themselves are well documented for good software suites like MS Office.
Related
I've got a small program I made to improve on simple work efficiencies. In effect it's just an application that has direct links to applications and websites, allows text input and formats it appropriately so this information to be stored and recalled quickly.
This has been running for years on our corporate machines (running Windows 7 and 8) just by emailing the .exe to myself with a password protected zip and starting it on the machine, but we're now upgrading to Windows 10 machines and these are locked down to the point where no foreign software can be ran. I know the reasons for this are security, but I am looking for a way around it or alternative way of deploying the software.
I am looking into getting the software authorised for use, but in effect this will be unlikely given how often I update and change things on it (or business changes frequently in terms of process and operation) - it would just be inconvenient.
It's a C# program. NET 4.5.
I can't get admin permission on these machines. Is there anything I can do?
Thanks!
If you cannot run untrusted applications, then instead build your solution within another product that you can use.
For example-- you can probably do all of your direct links to websites and any text input / reformatting you might need with javascript entirely within an html page. Open the .html file with your browser and there you have it.
You can also do many things with VBA scripts in Excel or Word documents.
You may also be able to use powershell to do your automation.
How Can a Web Page Display What Version a File is In Program Files Directory?
For example, if I wanted to send a user a URL that would show the user what version of our software is installed (version number and release date) on their Windows PC. I'm just talking about file properties, not actually running something.
Is there a way to do this with .Net/ASP.Net?
The answer is no.
The best you can do with HTML5 or Javascript is to let the user select a file and even then you have very limited access to properties (at most name, size and type) without having the user upload the file.
The most efficient solution right now would be to serve a very basic clickonce application which would locate the files, read the properties and send the information back to the server. From there you can choose to redirect the user back to your website with the information you collected.
Generally access to the Programm folder is limited at best. There used to be a time when we even would write data like Configuration files there. That was Windows 95/98. And it was frowned upon back then.
With the introduction of NTFS with Windows NT (and later XP in the Consumer area), enforceable rules were put in place. Rights tend to be highly limited. This is even more true of Webservers, as they tend to be prime targets for hacking. The only rights you can expected a Webserver to have is read rights to it's programm and the content directory. Maybe if the admin is really nice and it really helps with performance, it might have write rights on a Temporary subfolder of Contents.
Reading out your version from a file is propably possible with only read rights, but not the right way. Usually you just let the compiler hardcode (insert as constant) whatever Version is given in the Project file or by the Version Tracking Software.
So the first thing is that you need some approach of Version Control. And then your answer depends "however this Version control mechanism does tracking of the Compiled version". There is some limited version tracking support in Visual Studio itself. But there is also full, 3rd party Version tracking Software.
I'm creating a solution for managing remote MS Office documents. I used library made by IT Hit WebDAV System (www.webdavsystem.com) as a prototype. It's doing pretty well actually, except I cannot open document in read-only mode using URIs for office (based on Office URI Schemes by Microsoft).
I want to open the document in read-only mode, so someone else can edit it in the same time. As it can be seen in B-3. URI Scheme Syntax part of mentioned documentation, there are three commands available:
ofe - open for edit
ofv - open for view
nft - new from template
It seems that server acts always as "ofe" commands was given, no matter which one was used. Actually, entering "whatever" also works, it can be literally everything. Using MS Word for example, I post request order below:
OPTIONS => HEAD => OPTIONS => OPTIONS => LOCK => GET => PROPFIND => OPTIONS
As I am understanding correctly, successful LOCK attempt results in opening the document in edit mode. That tells me, that somewhere before that point MS WORD should ask for permission to do it, but I analyzed previous requests and was unable to find any related data.
It is not my environment issue also. I checked it with SharePoint and it was ok. That's why I would blame the server.
As I read that sentence(below) in this question,
most WebDAV clients ignore this and pretend that the entire server is either read-write or read-only
I started to wonder. Maybe that's the case? Maybe the library skips that and treats every file as read-write? If yes, how can I check it to be sure?
I've checked also this topic. The author mentions, that he has Office URI command in his OPTIONS requests, but links are no longer valid. In the requests that are sent by MS Office 2016, I can't find it anywhere. Should it be anywhere? Where?
Last, but not least, I found this topic. It seems to be exactly my problem, but it don't have the solution mentioned, or at least anything that worked in my case.
I will appreciate any help.
We have recently retested ofv and ofe options with latest MS Office 2016 for Windows and for Mac OS X with all updates installed. Here is what we have found:
On Windows this option is being ignored. Regardless of this parameter
MS Office opens as read-write.
On Mac OS this option is required. MS
Office respects this option and opens depending on ofv/ofe as
read-only or read-write.
From our experience there is no reliable way to open a document as read-only. In SharePoint Online (SPS 2016) there is also no option to open a document as read-only in the desktop version of MS Office.
One workaround could be throwing DavException in IFileAsync.WriteAsync() method implementation when saving a file. Please note that MS Office will ignore the message text being returned and will just display a generic error.
Another workaround would be marking a document as read-only in IMsItemAsync.GetFileAttributesAsync() method implementation:
public async Task<FileAttributes> GetFileAttributesAsync()
{
return fileSystemInfo.Attributes | FileAttributes.ReadOnly;
}
MS Office will display a yellow ribbon "UPLOAD FAILED This file is locked for editing by another user".
I am writing a C# console application which collects data about a machine and writes it to an external database. One of the bits of information it is necessary to collect is information about the software that is installed. There is a set of specific pieces of software we have that we would like to know about. Specifically which ones are installed, which versions are installed, and which patches they have had applied.
I have managed to acquire the information about which software is installed, and which versions they are, by querying the registry. However, when it comes to figuring out which patches are installed I am a little stumped.
I know that if I go to Control Panel -> Programs -> View installed updates I can see the patches I have installed for these software (specifically, it gives me the exact patch number - ie, Patch 21). So, I would like something similar. I found WUApiLib and thought it would be the answer to my problems, but when I query the update history all that is returned is a list of Microsoft updates to the OS, .NET, Visual Studio etc. There is no mention of the patches I applied to our software.
I am not very familiar with how patching works, but I believe the patches use msp file format, so I think the information should be logged by Windows somewhere. How does Control Panel get it? Where might I be able to get it? The registry entries under HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/Uninstall do not mention patches at all.
So, after some digging around I found a different part of the registry which lists all the information I needed.
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products
This contains the name and version of software installed (under <GUID>\InstallProperties) and patches installed for each (under <GUID>\Patches)
I've been searching for a solution for a few days now, I've looked through the MSDN for Interop.Outlook and I think I've found what I need, but can't seem to implement it properly.
Here's the code I've came up with based on something similar I saw in VBA.
class Program
{
Stores allstores = new Stores();
Store store;
static void Main(string[] args)
{
foreach (var store in allstores)
{
MessageBox.Show(store.FilePath);
}
}
}
`
This essentially needs to cycle through a list of computers, and run this code on their outlook(some 2003, some 2007) in order to inventory all connected PST's in each outlook profile. I'm sure there's more code to this, but I can't get this portion to work at all. There seems to be a lack of information on inventorying Outlook data files, most of it is reading e-mails from the mailboxes and not the data file itself.
If someone could shed some light on what I'm overlooking, It'd be greatly appreciated.
EDIT:
I've actually made a working piece of code now, however I have a problem with compatibility. The program works as designed in Office 2010/2007, however it crashes when accessing a 2003 version. I imagine I need to use the Microsoft Office Object 11.0, however I only have Microsoft Office Object 12.0 listed - is there a way to get the 11.0 reference?
This may be of use, pretty thorough object model comparison and development guide.
There is no reason to actually log to any Outlook profiles (which might require an authentication prompt). All the information is already in the profile section in the registry. The exact location is Outlook version specific, and the profile section guids are generated randomly, so the documented profile management API (IProfAdmin etc.) is the way to go, but unfortunately it is Extended MAPI and requires C++ or Delphi.
As of Outlook 2007, Outlook Object Model exposes Namespace.Stores collection and Store.FilePath property, so you can loop through all stores and read the FilePath property for each store (be sure to filter out OST files).
Note that there can be multiple Outlook profiles (as shown in Control Panel | Mail | Show Profiles), but Outlook can only work with one profile at a time, so to use a different profile, you'd need to close Outlook.
If using Redemption is an option (I am its author), it includes ProfMan library (accessible in any language) which will let you extract all PST file locations from all local profiles without actually logging in.:
'Print the path to all the PST files in all profiles
PR_PST_PATH = &H6700001E
set Profiles=CreateObject("ProfMan.Profiles")
for i = 1 to Profiles.Count
set Profile = Profiles.Item(i)
set Services = Profile.Services
Debug.Print "------ Profile: " & Profile.Name & " ------"
for j = 1 to Services.Count
set Service = Services.Item(j)
If (Service.ServiceName = "MSPST MS") or (Service.ServiceName = "MSUPST MS") Then
'there should be only one provider for this service
'but we should really loop through all the providers
Debug.Print Service.Providers.Item(1).ProfSect.Item(PR_PST_PATH)
End If
next
next