Posted On July 15, 2021

PowerShell: Query Google Account Using GAM

kimconnect 0 comments
blog.KimConnect.com >> Codes , Windows >> PowerShell: Query Google Account Using GAM
$emailAddress='[email protected]'
$field='accounts:last_login_time'

function getGamUser{
    param(
        $emailAddress,
        $field
    )

    $result=try{gam report users user $emailAddress}catch{}
    if($result){
        $headers=$result[0] -split ','
        $index=$headers.IndexOf($field)
        return ($result[1] -split ',')[$index]
    }else{
        write-warning "$emailAddress field $field has not matched anything"
        return $null
    }
}

getGamUser $emailAddress $field

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Install FOG, an Open Source Machine Backup and Cloning Solution

- Install Ubuntu or Centos - Install FOG - On Windows Client, run sysprep, then…

Credit_Invoice_Reprints_ZZ6_7_8.bat

fsguiapp.exe -cm:\mfgsys\fs.cfg -iZZ1{TAB}y2k99{CR}bexe{ESC}zz6{CR}M:\cabsauto\timeout 15fsguiapp.exe -cm:\mfgsys\fs.cfg -iZZ2{TAB}y2k99{CR}bexe{ESC}zz7{CR}M:\cabsauto\timeout 15fsguiapp.exe -cm:\mfgsys\fs.cfg -iZZ3{TAB}y2k99{CR}bexe{ESC}zz8{CR}rem M:\cabsauto\timeout 15rem fsguiapp.exe -s -cm:\mfgsys\fs.cfg -iZZ4{TAB}y2k99{CR}bexe{ESC}zz4{CR}

PowerShell: Find Process ID (PID) Locking a Certain File

Here's a function to kill common processes (Antivirus executable excluded) locking a particular file. This…