Remotely checking file versions using PowerShell

Hi
Can anyone give me a start. I support many servers and PCs remotely which I have remote access to. I would like to be able to check file versions on servers and Pcs remotely to see if I can save myself any time.
I've managed this befo using VBS and just wondered if the same was possible using Power Scripts.
Can anyone point me in the right direction please - I'm very new to PS also :)
Kind Regards
Matthew

That's looking for a .VersionInfo property on a string. Try this (notice the parentheses):
(Get-ChildItem '\\10.1.2.3\c$\temp\Test.exe').VersionInfo
That's going to return its own object, though. Explorer is going to show you four of the properties from that combined. The easiest way to get something is to just use the 'FileVersion' property, but again, that's not always reliable if you're interested
in build/private versions, and it's not what Explorer shows you.
If you use the Update-TypeData (or the .ps1xml for v2) from the
gallery page I mentioned, you could do this:
(Get-ChildItem '\\10.1.2.3\c$\temp\Test.exe').PSFileVersion
And that would give you the version Explorer shows you. You can also use comparison operators against other "Version" types.
You can put the steps required to set that up in your profile, and then that computer will always have that property on file objects.

Similar Messages

  • Checking File version

    Hi
    I'm working on a powershell script that will check if a dll files version is correct on lots of servers. To keep it quite basic, I would like to output a warning in red to the screen. This is what I need.
    This is what I have written so far but not sure what the best path to follow is if anyone can advise.
    $xFile = "\\10.1.2.3\c$\Program Files\Company\Server Modules\DataModule.dll"
    $xFileVersion = (Get-Command $xFile).FileVersionInfo
    # Need to put some kind if statement here to check the file version number and warn me if the version is not v1.2.3
    Much appreciated to anyone who can give me a hand
    Matt

    The VersionInfo property is actually capable of returning an accurate file version, but you have to combine four subproperties:
    - FileMajorPart
    - FileMinorPart
    - FileBuildPart
    - FilePrivatePart
    You could compute the version with those each time you need it, but I update the type information for all file objects so that an extra 'PSFileVersion' property is added to all files (so the PS type system does the work for me). On PSv3, you can simply run
    the following command, and all files will have that property:
    Update-TypeData -TypeName System.IO.FileInfo -MemberType ScriptProperty -MemberName PSFileVersion -Value {
    if ($this.VersionInfo.FileVersion) {
    [version] ("{0}.{1}.{2}.{3}" -f this.VersionInfo.FileMajorPart,
    $this.VersionInfo.FileMinorPart,
    $this.VersionInfo.FileBuildPart,
    $this.VersionInfo.FilePrivatePart)
    On PSv2, you'd need to use a
    ps1xml file.
    The WMI solution works great, but here's an alternate one that can be used with Get-Item and/or Get-ChildItem (if you don't update the type information above, you could create a property with select-object that builds this property).
    If you can access remote systems through admin shares, then you could do something like this:
    $FileName = '\\{0}\c$\Program Files\Company\Server Modules\DataModule.dll'
    $ExpectedVersion = '1.0.0.0'
    # This will only output files where the version isn't at least $ExpectedVersion
    # You can change -lt to -ne if you’re looking for the version to be exactly the same
    echo computer1, computer2, computer3 |
    foreach { Get-Item ($FileName -f $_) | select fullname, psfileversion } |
    where { $_.PsFileVersion -lt $ExpectedVersion }
    or this:
    $FileName = '\\{0}\c$\Program Files\Company\Server Modules\DataModule.dll'
    $ExpectedVersion = '1.0.0.0'
    # This will output an object for each computer that has a Pass property that's either true/false
    echo computer1, computer2, computer3 | foreach {
    $ObjectProps = @{
    Computer = $_
    FileName = $FileName -f $_
    if ((Get-Item ($FileName -f $_)).PSFileVersion -lt $ExpectedVersion) {
    $ObjectProps.Pass = $false
    else {
    $ObjectProps.Pass = $true
    New-Object PSObject -Property $ObjectProps
    Of course, you could modify this to be a function that allows you to feed computer names to it. You could also change the first command in the pipeline (echo) to any other command that will give you a list of computer names.

  • How to read contents of a file version using version url

    Hi,
    I have a file in a document library say "MyFile.txt". Versioning is enabled and there are three version of it
    What i want now is that , by passing the url of version i got from SPFileVersion class, i must be able to read the contents of it.
    Can anyone pls help me
    Arjun Menon U.K

    You can use the following line of code to get the content of a specific version
    SPFolder fld = web.Folders["Documents"];
    SPFile file = fld.Files["Documents/MyFile.txt"];
    //specific version
    SPFileVersion version = file.Versions[1];
    //Get the data
    byte [] dBytes = version.OpenBinary();
    Refer to the following posts for more information, hope it helps
    http://blogs.msdn.com/b/karthick/archive/2006/03/28/563045.aspx
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/8d2619bf-34e9-421b-85c1-792b2a9e8ae9/spfileversioncollection-specific-version?forum=sharepointdevelopmentlegacy
    --Cheers

  • Check file version APXPMTCH.fmb

    I am looking to implement a new patch and it directs me to check the file version of two specific files: APXPMTCH.fmb, APXRMTCH.fmb.
    How can I do this while logged into a Unix shell?
    (Patch #: 5999469)

    It should be there.
    To verify, please login as applmgr user, source the env file, and issue the following:
    $ cd $APPL_TOP
    $ find . –name APXPMTCH.fmb
    And ..
    $ find . –name APXRMTCH.fmbThe above should return the directory path where those files are located.

  • Get Remote Desktop access logs using PowerShell

    How to find all login/Logout/Reconnect and other log information from a remote computer using powershell
    This should also include from which client/machine (including which account) that connection has established.
    may be more in brief, like a RDP historical log, i.e., who all logged and performed what from startdate to enddate.
    Suresh Kumar Udatha.

    You would have to write a script to remotely query the Event log for all logon types required.  You would also need to write custom record data extractors for each log message type.
    I recommend starting in the Gallery and looking for scripts that query the windows event logs.  THis will show you the basics of event log reporting using PowerShell.
    What you are asking is a very large project.  The records you need are different fro different OSs.  Pre-Vista uses the old format and event IDs. Vista and later use a newer format.
    Security log performing is a specialized industry.  There are many companies that produce tools to do this.  I recommend looking into purchasing this tool.
    It can be written in PowerShell. I have written many event log extraction scripts.  It will take you quites some time to do as many record types as you aare asking for.
    ¯\_(ツ)_/¯

  • Managing files version using RIDC.

    Hi everyone!
    I would like to get an checked IN/OUT file depending on a specific version.
    I know it's possible to do such a task using web interface. However I have to do this programmatically using RIDC.
    Is there any service that can do the task?
    Thanks in advance,
    José Teixeira.

    See if the below threads are of any help
    http://forums.adobe.com/message/3579104
    Also, check this troubleshooting document.
    http://helpx.adobe.com/dreamweaver/kb/troubleshoot-javascript-errors-d reamweaver-cs4.html

  • Checking file exist using file exist operator

    Hi all,
    My environment is owb 9i. DB is oracle 9.2.0.8
    My business requirement is,
    If file exists in the landing directory the next instant my mapping should start execution other wise it should wait untill the file arrives there.
    How could i achive this functionality???
    For this i am utilizing the file exist operator in process flow.
    When the file exists in the specified directory i am able to execute the process flow quite fine but when the file doesnt exist in the specified directory the file exist operator is in wait state and even after when the file is placed into the directory, still the process flow remains in the wait state.
    please suggest me a way.
    thanks in advance.
    ram.

    Hi Ram,
    The problem you are hitting here is that there is no wait activity and no loop activity (yet) in the process flow editor. So it is hard to model this logically.
    Would it be a good idea to write shell script that does similar things? You could check for a file, pauze and check again. Then error out or succeed...
    In the 10gR2 release of OWB you can completely model this using waits and loops.
    Thanks,
    Jean-Pierre

  • Anyone using FCP's file manager to remotely share files, anyone using FCP's file manager to remotely share files?

    Hi:
    I am looking to build a solution for a prospective client.  I want to use FCP server's file manager to allow remote users to access and obtain content.  This arrangement is actually for healthcare solution. I know FCP is used to manage and transfer files, but I am not sure what controls, access, etc are available to make assurances these files are not manipulated.

    I've been using FCP for a long time and I do not know of "file manager" tool. Are you looking for an evaluation of FCP Server? That's a different forum, not many users of that app here.
    bogiesan

  • Add YYYYMMDD_xyz_ftp in front of the file name using PowerShell

    Hi All,
    I am working on a PowerShell script to generate a dat file. I need to change the format of this file as follows:
    Original File Name: eagle.dat
    Required File Name: YYYYMMDD_CA_eagle.dat
    I know that we can do this very easily from Windows Cmd like below. I have written this massive PowerShell script which I do not want to be wasted just because of this last step.
    rename eagle.dat %date:~-4,4%%date:~-10,2%%date:~-7,2%_CA_eagle.dat
    Thank you in advance for your reply.
    Ben

    Hi Ben,
    Give this a try:
    Rename-Item -Path .\eagle.dat -NewName ("{0:yyyMMdd}_CA_eagle.dat" -f (Get-Date))
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • Check powershell.exe file version

    I am learning SCCM 2012 and I put together a query to check the file version of powershell.exe to see if the computers are running v2.0 or v3.0. Here is the query. When I run it, nothing shows up. I have a few computers with powershell installed.
    select SMS_R_System.Name, SMS_R_System.LastLogonUserName, SMS_G_System_SoftwareFile.FileVersion from  SMS_R_System inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName
    = "powershell.exe" order by SMS_R_System.Name
    When I change powershell.exe to winword.exe I get more than 100+ computers listed. I even give it the file path (C:\Windows\SysWOW64\WindowsPowerShell\v1.0) but it still does not work
    Thanks for your help
    Freddy91761_1

    This might interest you as well
    http://be.enhansoft.com/post/2014/01/15/PowerShell-Inventory-Reports.aspx
    Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually
    answer your question). This can be beneficial to other community members reading the thread.
    This forum post is my own opinion and does not necessarily reflect the opinion or view of my employer, Microsoft, its employees, or MVPs.
    Twitter:
    @alexverboon | Blog: Anything About IT

  • .xml file version.

    Hello, i am new to oracle.
    I have applied patch and after patch, there is need to check file version.
    The thing is i dont know in witch top to find this file, i have looked everywhere. Could anyone give me some pointers?
    ExternalPayeesVO.xml this is the file.
    regards. thx

    Hi;
    You can go with:
    strings (file_name).class | grep Header
    strings (file_name).xml | grep Header
    Referance:
    How To Find The Version Of An Internet Expenses Java or Xml File? [ID 278248.1]
    PS:Please dont forget to change thread status to answered if it possible when u belive your thread has been answered, it pretend to lose time of other forums user while they are searching open question which is not answered,thanks for understanding
    Regard
    Helios

  • How to get files with no checked in version from library that has exceeded the threshold limit

    I have exceeded the threshold limit for library, when I click on "Manage files which have no checked in version"
    I get error that threshold limit has been exceeded for library, so I am not able to use this option.
    Please let me know if there is any workaround or script that can be used to get this done.
    or if we can modify the view with some query

    Hi niles, Here is a page that details how to retrieve all the files and take ownership of them via powershell to check them in:
    http://www.demantprasad.com/2013/05/manage-files-which-have-no-checked-in.html
    Mathieu Desmarais http://www.matdesmarais.com/

  • Where can I find guidance on labeling files during a check in process using DWCS6 with Subversion?

    I am using DWCS6 with VisualSubversion server 2.1.9. I have been successful setting up the repository and checking in version 1.0 of my code. Now that it is time to modify code, I want to label my changes. I see the commit message box at the bottom of the CheckIn dialog. I use it for a description of the change (e.g. "Change picture of man with picture of woman.") which works for small changes or changes to one or two files but it is not practical for large change sets or complex changes. I'd like to create a label as well using a numeric versioning system.  I have not found where I can do that. Is the commit message the only option or is there a way to use labels?
    I appreciate your help with this.
    Jeff

    Hello,
    How about creating an artice in the WIKI here?
    http://social.technet.microsoft.com/wiki/
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Using powershell to deploy provider-hosted app and specify remote Url instead of using appinv.aspx page

    Hello all,
    Could you possibly help me with provider-hosted app development/deployment process.
    We developed SharePoint provider-hosted app that works just fine in development environment. Now we need to automate it's installation in test environment via powershell.
    In AppManifest.xml that we are deploying we have key instead of explicit URL:
    <App xmlns="http://schemas.microsoft.com/sharepoint/2012/app/manifest" Name="ShowAllRoomsApp" ProductID="{922a18aa-5592-b59a-4da9-4791baef02e7}" Version="1.0.0.0"
    SharePointMinVersion="15.0.0.0">
      <Properties>
        <Title>SomeTitle</Title>
        <StartPage>~remoteAppUrl/Pages/Default.aspx?{StandardTokens}</StartPage>
    If we use as
    https://technet.microsoft.com/en-us/library/jj655398.aspx recommends, we cannot specify Redirect Url as we can do this on
    /_layouts/appinv.aspx
    So now it seems like the only way to deploy this kind of solution is using appinv.aspx page.Or must we apply this URL in AppManifest on developing stage in Visual Studio?
    What did I miss?
    P. S. Even if I use /_layouts/appinv.aspx after powershell commandlets, I get error.

    hi,
    to deploy provider hosted app you need 2 things
    1. Client ID
    2. Redirect URL.
    What you can do you can generate app from visual studio using clientID and URL from developer enviornment.
    Now a app file is just a simple compressed zip file if you rename it as .zip and extract you will find AppManifest
    inside it. So to create an app for Testing enviornment what you have to to Get the CLient ID (from AppRegNew.aspx) in testing enviornment. Unzip .App file change the AppManifest with testing client ID and URL than again zip file and rename as .app.
    Now if you upload this file it will work.
    To automate this scenerio i have created a simple windows Application in which i Pass the Client ID and StartURl and an App File it unzips the app file make changes to app and again zip it.
    public static class AppPackageHelper
    public const string StartUrlExpression = "{0}?{1}";
    public const string StandardToken = "{StandardTokens}";
    public static string Publish(string appPath, string ClientId,string StartUrl)
    string tempDir = string.Empty;
    string outPutFile = string.Empty;
    try
    string parentDir = System.IO.Path.GetDirectoryName(appPath);
    outPutFile = System.IO.Path.Combine(parentDir, ClientId + "-Winshuttle.app");
    tempDir = System.IO.Path.Combine(parentDir, ClientId.ToString());
    Directory.CreateDirectory(tempDir);
    int lastInd = appPath.LastIndexOf('.');
    string tempPath = string.Empty;
    string targetFilePath = string.Empty;
    string cabPath = System.IO.Path.Combine(tempDir, System.IO.Path.GetFileNameWithoutExtension(appPath) + ".cab");
    FileInfo fInfo = new FileInfo(appPath) { IsReadOnly = false };
    File.Copy(appPath, cabPath);
    XDocument doc = null;
    string appManifest = string.Empty;
    using (ZipArchive zipArch = ZipFile.Open(cabPath, ZipArchiveMode.Update))
    appManifest = string.Format(@"{0}\AppManifest.xml", Directory.GetParent(cabPath).FullName);
    ZipArchiveEntry manifestEntry = zipArch.Entries.LastOrDefault(e => e.Name.ToLower() == "appmanifest.xml");
    manifestEntry.ExtractToFile(appManifest);
    doc = XDocument.Load(appManifest);
    XNamespace ns = doc.Root.GetDefaultNamespace();
    string defaultUrl = string.Format(StartUrlExpression, StartUrl.TrimEnd('/'), StandardToken);
    doc.Descendants(XName.Get("StartPage", ns.NamespaceName)).First().Value = defaultUrl;
    doc.Descendants(XName.Get("RemoteWebApplication", ns.NamespaceName)).First().Attribute(XName.Get("ClientId")).Value = setupInfo.ClientId.ToString();
    doc.Save(appManifest);
    if (manifestEntry != null)
    manifestEntry.Delete();
    zipArch.CreateEntryFromFile(appManifest, "AppManifest.xml");
    int totEnt = zipArch.Entries.Count;
    for (int e = 0; e < totEnt; e++)
    if (zipArch.Entries[e].Open().Length == 0)
    //if (zipArch.Entries.Count > totEnt && e >= totEnt) break;
    //zipArch.CreateEntry(zipArch.Entries[e].FullName);
    File.Delete(appManifest);
    if (File.Exists(outPutFile))
    File.Delete(outPutFile);
    File.Move(cabPath, outPutFile);
    return outPutFile;
    catch
    throw;
    finally
    if (System.IO.Directory.Exists(tempDir))
    System.IO.Directory.Delete(tempDir, true);
    return outPutFile;
    using System.IO.Compression.FileSystem.dll.
    Also if you want to do it using powershell You need to do the same thing unzip-> changes values-> zip
    So basic thing is You need to ahve only valid AppManifest file which contains 2 valid values Client Id and StartUrl
    if you changes it inside appmanifest manuall than it will also work. Using above code you can create a console Application to do it. You can use powershell it just that i dont know how to zip unzip in powershell but i am pretty sure you can easily find it
    on searching.
    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

  • Search and Replace text in file using PowerShell

    I want to schedule a script in PowerShell to search a directory for an XML file for a particular text string and replace it with a different text string and then save the file with the same name, the name of the file
    will change each time the script is run on a daily basis. There will only be one XML file in the location when the scheduled script is run.
    I have never used PowerShell but am familiar with batch file commands, can anyone please help!!
    KevinS

    Hi Kevin,
    I’m writing to just check in to see if the suggestions were
    helpful. If you need further help, please feel free to reply this post directly so we will be notified to follow it up.
    If you have any feedback on our support, please
    click here.
    Best Regards,
    Anna
    TechNet Community Support

Maybe you are looking for