Pages

Thursday, 20 January 2022

Installed application is higher than current version

$currentversion = "97.0.4692.90"

function Get-ApplicationVersion {
    $applicationName = "Google Chrome"
    $my_check = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, InstallDate | Where -Property DisplayName -Match $applicationName
    $versionNumber = $my_check.DisplayVersion
    if ($my_check) {
        $versionNumber
    }
    else {
        write-warning "Application not found"
    }
}
$version = Get-ApplicationVersion
If ($version -gt $currentversion) {
Write-host "Alredy higher version installed in the machine"
}
Else {
Write-host "Installing the current version"
}

Thursday, 6 January 2022

Copy File to user profile while installing through system contest

 For /F "tokens=2* delims= " %%u IN ('Reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /V ProfilesDirectory') DO Set ProfilesDir=%%v

Set ProfilesDir=%profilesDir:%%SystemDrive%%=%\%ProfilesDir:~14,100%

For /F "tokens=*" %%d IN ('Dir /ad /b "%ProfilesDir%"') DO (

If /I NOT "%%d" == "ALL USERS" (

xcopy "%~dp0FIlezilla" "%ProfilesDir%\%%d\appdata\Roaming\FileZIlla" /y /e))

User based detection

function getloggedindetails () {     ##Find logged in username     $user = Get-WmiObject Win32_Process - Filter "Name='explorer...

Search This Blog