Scripts Reference
Table of Contents
This document describes each of the custom functions available for PowerShell and Mac Bash.
Notes:
- For more details and examples, see the PowerShell or Mac Quick Help at the bottom of any new/edit script page in Syncro.
- Be sure to include Import-Module $env:SyncroModule as the first line in your script.
Although the syntax differs slightly, Syncro provides the following custom functions for both PowerShell and Mac Bash.
RMM Alert
Creates an alert in Syncro and triggers the "New RMM Alert" in the Notification Center, automatically de-duping per asset. For example, a script to check whether hard drive space is below a certain percent can trigger an RMM Alert in Syncro, which ties into the dashboard and triggers a notification. This can be also hooked into anything you can script in PowerShell (e.g., the Event viewer, WMI, etc.). See also Customize & Assign Notifications.
PowerShell | Mac |
---|---|
Rmm-Alert -Category 'sample_category' -Body 'Message Here' | syncro rmm-alert --category="sample_category" --body="Message Here" |
Display Alert
Pops up a message for the currently logged in user. This must be used with a script running as “current user.”
PowerShell | Mac |
---|---|
Display-Alert -Message "Super important message here" | syncro display-alert --message="Super important message here" |
Log Activity
Adds a row to the "Recent Activity" section on the Asset's Details Page.
PowerShell | Mac |
---|---|
Log-Activity -Message "Activity description" -EventName "Event name" | syncro log-activity --message="Activity description" --event-name="Event name" |
Get Screen Capture
Saves a screenshot to the filename you specify, which is great to use with Required Files.
PowerShell | Mac |
---|---|
Get-ScreenCapture -FullFileName "C:\temp\screenshot.jpg" | syncro get-screen-capture --full-file-name="/tmp/screenshot.jpg" |
Send Email
PowerShell has SMTP Email already, but you have to add an SMTP server. Our Send-Email function uses our API and doesn't need anything except Internet access.
PowerShell | Mac |
---|---|
Send-Email -To "kali.patrick@syncromsp.com" -Subject "Test Subject" -Body "This is the body" | syncro send-email --to="demo@syncromsp.com" --subject="Test Subject" --body="This is the body" |
Upload File
Uploads a file to Syncro and attaches it to the Asset.
PowerShell | Mac |
---|---|
Upload-File -FilePath "C:\temp\screenshot.jpg" | syncro upload-file --file-path="/tmp/screenshot.jpg" |
Set Asset Field
Writes to your Asset Custom Fields. Use it to store ad-hoc information that isn't currently surfaced.
PowerShell | Mac |
---|---|
Set-Asset-Field -Name "Field Name" -Value $someVariable | syncro set-asset-field --name="Field Name" --value=$someVariable |
Create Syncro Ticket
Creates a Ticket attached to the Asset the End User associated with it.
PowerShell | Mac |
---|---|
Create-Syncro-Ticket -Subject "New Ticket for $problem" -IssueType "Other" -Status "New" | syncro create-syncro-ticket --subject="New Ticket for $problem" --issue-type="Other" --status="New" |
Create Syncro Ticket Comment
Adds a Ticket Comment/Communication to a ticket. This can be public/private, email or not, etc. See also About the Ticket Communications Section.
PowerShell | Mac |
---|---|
Create-Syncro-Ticket-Comment -TicketIdOrNumber 123 -Subject "Contacted" -Body "This is the comment body here" -Hidden "true/false" -DoNotEmail "true/false" | Create-Syncro-Ticket-Comment -TicketIdOrNumber 123 -Subject "Contacted" -Body "This is the comment body here" -Hidden "true/false" -DoNotEmail "true/false" |
Create Syncro Ticket Timer Entry
Adds a timer entry to a ticket. See also Add Billable Time to a Ticket.
PowerShell | Mac |
---|---|
Create-Syncro-Ticket-TimerEntry -TicketIdOrNumber 123 -StartTime $startAt -DurationMinutes 30 -Notes "Automated system cleaned up the disk space." -UserIdOrEmail "your.user.email@here.com" -ChargeTime "true/false" |
syncro create-syncro-ticket-timer-entry --ticket-id-or-number=123 --start-time=$startAt --duration-minutes=30 --notes="Automated system cleaned up the disk space." --user-id-or-email="your.user.email@here.com" --charge-time="true/false" |
Update Syncro Ticket
Updates a ticket; currently this only supports Status and custom fields. See also Create Custom Fields for Assets & Tickets.
PowerShell | Mac |
---|---|
Update-Syncro-Ticket -TicketIdOrNumber 123 -Status "In Progress" -CustomFieldName "Automation Results" -CustomFieldValue "Results here for example" | syncro update-syncro-ticket --ticket-id-or-number=123 --status="In Progress" --custom-field-name="Automation Results" --custom-field-value="Results here for example" |
Close RMM Alert
Closes an RMM alert in Syncro. Since there can only be one of each alert category per asset, it will find the correct one. If no alert exists it will exit gracefully. You can also choose to close a Ticket generated from the alert.
PowerShell | Mac |
---|---|
Close-Rmm-Alert -Category "sample_category" -CloseAlertTicket "true/false" | Close-Rmm-Alert -Category "sample_category" -CloseAlertTicket "true/false" |
Broadcast Message
Sends a broadcast message to the asset and optionally adds a row to the "Recent Activity" section on the Asset's Details Page.
PowerShell | Mac |
---|---|
Broadcast-Message -Title "Title Text" -Message "Super important message" -LogActivity "true/false | syncro broadcast-message --title="Title Text" --message="Super important message" --log-activity |