Author Posts

August 3, 2018 at 4:18 pm

Looking for a PS script to go into say, c:\ProgramData\folder name\ and then access a file in that folder to look for say a number which could be 12345 or 67890. Once that info is available then write to a .txt file to a new work drive. This would be done on domain computers so along with the info pulled, the workstation name would need recorded in the .txt file.

Basically we are trying to figure out which licenses we have for Adobe Acrobat Standard and Pro in version DC 15. Everything is identical in both version, (thanks Adobe developers) so the only place to find it is in this folder, C:\ProgramData\regid.1986-12.com.adobe and the file within the folder is, regid.1986-12.com.adobe_V7{}AcrobatESR-12-Win-GM-en_US.swidtag. There is a number that indicates the version within this file which is either 910182852482311501575735 or 970789451874493447273891 which will indicate what version is installed. We've tried a number of ways and it seems a PS script will do the trick but I'm only a beginner at PS.
Thanks!

August 3, 2018 at 4:43 pm

I am assuming you will be running this as a logon script? Quick and dirty, I believe this should work. There are probably other, more elegant ways to accomplish this – but I think the logic flow is straight forward.

$path =  'C:\ProgramData\regid.1986-12.com.adobe'

# not sure which number is for which product?
$standard = '910182852482311501575735'
$pro = '970789451874493447273891'

# hashtable for output properties
$prop = @{
    ComputerName = $env:COMPUTERNAME
    Version = 'File Not Found'
}

# create a custom object for cleaner output
$obj = New-Object -TypeName psobject -Property $prop 

if(Test-Path -Path $path)
{

    $StandardSearch = Select-String -Path $path -SimpleMatch $standard
    $ProSearch = Select-String -Path $path -SimpleMatch $pro 
    
    # this will break if, for some reason both numbers exist in the file,
    # it will always return Standard
    if($StandardSearch -ne $null)
    {
        $obj.Version = 'Standard'
    }
    elseif($ProSearch -ne $null)
    {
        $obj.Version = 'Pro'
    }
    else
    {
        $obj.Version = 'Something Else'
    }


}

# save the file to the network share
$obj | Export-Csv -Path "\\server\share\$env:COMPUTERNAME.csv" -NoTypeInformation -Force

August 3, 2018 at 5:17 pm

Awesome Stephen! I will give it a try. Thank you very much. 🙂