There’s a lot going on there crammed into a one-liner. Here’s an un-minimized + formatted version for readability:
$rk=(gp -Path 'HKLM:\SOFTWARE\WOW6432Node\RepairTech\Syncro');
$fp='C:\ProgramData\Syncro\bin\';
$env:SyncroModule=$fp+'module.psm1';
$env:RepairTechApiBaseURL='syncromsp.com';
$env:RepairTechApiSubDomain=$rk.shop_subdomain;
$env:RepairTechFilePusherPath=$fp+'FilePusher.exe';
$env:RepairTechUUID=$rk.uuid;
Import-Module -Name $env:SyncroModule -DisableNameChecking;
$aID=[regex]::match($rk.SyncroOptions,'asset_id.\:.(\d*)').captures.groups[1].value;
$aURL='https://'+$rk.shop_subdomain+'.syncromsp.com/customer_assets/'+$aID;
$wsh=(New-Object -ComObject Wscript.Shell);
$nn=[Environment]::NewLine+[Environment]::NewLine;
$sfp='C:\temp\sysTray-screenshot.jpg';
$wsh.Popup('Please wait a few seconds while we grab a screenshot...',3,'📷 Saving Screenshot',0+64);
Get-ScreenCapture -FullFileName $sfp;
$error.clear();
try{Upload-File -FilePath $sfp}catch{};
if(!$error){
Send-Email -To '[your_email]' -Subject 'Screenshot Saved' -Body ($rk.LastUser+' screenshotted '+$aURL);
if($wsh.Popup('Screenshot now on file.'+$nn+'Do you need to open a *new* ticket to Request Support?',0,'📷 Screenshot saved!',4+32) -eq 6){start '[your_helpdesk_url]';}
}else{
Log-Activity -Message $error -EventName 'Syncro [your_company_name] SysTray error';
$wsh.Popup('Error saving screenshot!'+$nn+'Please try again.',0,'📷 Screenshot FAILED',0+48);
};
Here’s the English overview:
- reads out critical info from the registry
- sets environment variables so we can make Syncro API calls (since we’re not running in a Syncro script), specifically Get-ScreenCapture and Upload-File
- preps needed variables
- popups a user notice
- saves a screenshot
- tries to upload it to the asset, with error handling (Syncro’s API sometimes fails here)
- popups a confirmation and prompts the user for the helpdesk
- if yes, then opens that URL
The only thing you SHOULD have to do is fill-in-the-blanks for [your_email], [your_helpdesk_url], and [your_company].