Toggle navigation
Resources
Help Guides
Wiki 'How to'
Custom Scripts
Developer APIs
Server Status
Release Notes
Support Center
Community Forums
Register
Login
Welcome to the Custom Scripts Resources
SEARCH
If this is your first time visiting our community resources, you’ll
have to
register
before you can begin joining the discussion.
×
Login
Username
Password
Remember Me
Login
Categories
Show All
(1310)
Windows Updates
(1)
Stolen computer
(6)
Monitoring
(0)
Action
(3)
Monitoring
(8)
Action
(21)
Monitoring
(3)
Action
(36)
Monitoring
(3)
Action
(105)
Monitoring
(15)
Action
(57)
Monitoring
(4)
Action
(20)
Monitoring
(7)
Action
(17)
Monitoring
(1)
Action
(21)
Monitoring
(9)
Action
(74)
Monitoring
(22)
Action
(178)
Monitoring
(26)
Action
(186)
Monitoring
(0)
Action
(1)
Server Maintenance
(0)
Desktop Maintenance
(3)
Monitoring
(49)
Action
(170)
Monitoring
(14)
Action
(70)
Monitoring
(2)
Action
(24)
Monitoring
(12)
Action
(49)
Monitoring
(3)
Action
(6)
MAC Scripts
(2)
Services/Processes
(2)
Disks
(0)
Computer Settings
(1)
Manage Files/Folders
(1)
Software and App
(1)
Bitlocker
(0)
Domain Scripts
(0)
Migration
(0)
Backup and Recovery
(0)
One off status check
(0)
Maintenance
(2)
Offboarding
(56)
Onboarding
(18)
User Management
(0)
Networking
(0)
Patching
(0)
Reporting and Email
(1)
Tags
NUMsp
Adobe
Adobe Flash
Secure Internet Gateway
Stolen
Linux Devices
Office scan
Trend micro
wallpaper style
colour
count
uninstall slack
slack
Windows server backup
Event id
Retrieve
Implementation
module
Toast
send
VBScript
next logon
generation
Locked
Unlock
AD Computer
tickets
desk
AD User
AD
Cylance Protect
cylance
Remote Control by ITarian
Itarian Communication Client
Encrpyt
Uptime
test
internet
properties
serial
shadow
Lockscreen
Hardening
Enumeration
Net Session
netcease
DLP
attack
Brute force
Trace
CPU
repair
mask
Subnet
Public IP
Internet explorer 11
Nitro
Upgrade Assistant
Spiceworks agent
forticlientssl vpn
activate
dates
between
mailbox
exchange
save
CES
comodo endpoint security
CAVS
image files
photo
webcam
capture
unblock
close
opened
Generator
Random
power plan
hash
bandwidth
MODEL
Hunter
Unknown
CA
trusted root cerficate
avira
shortcuts
arrow icon
user folder
log file
full scan
sorting
policy
video
audio
File types
System Boot Time
Boot time
speed
Trend Micro Worry-Free Business Security Services
Instance
US
EU
C1
apache
wallpaper
Education
Consumer
sentinelone
without reboot
decrypt
comdom ESM agent
ESM
without authentication
with authentication
No restart
authentication
Upload
Documents
Cobian backup
triggering
defender
without
with
CisReportTool
C1 logs
printer
port name
ping
pubnub
zip file
file transfer
winscp
adifosensu
Recovery key
synchronize
NTP server
caskroom
Existing
Firewall Rule
match
expire
loggedin user
internet connection
windows lock
Dome agent
website
certain time
priority
product keys
msoffice
word macros
dotm file
dotm
windows 10
outlook
PST
Image
vaccine
Petya
ransomware
local drive
permission
interval
interva;
browser
.msu
win 7 workstation
TKINTER
ethernet
windows update
metered
Virtual
manager
FTP
states
windows features
teamviewer host
SQL
workgroup
contents
resume
pause
free edition
maxthon browser
QualityCompact
Panda Antivirus
HP
one
operation system
fastboot
and
labtech
Vulnerability
SEP
Software Inventory
WEBROOT
comodo dome agent
comodo cloud antivirus
Vipre Business Agent
Malwarebytes Anti-Exploit
plugged in
sleep
uptodate
Time out
zip
autostart
client agent
encryption
recover
sub system
software distribution
screenshot
product key
ms office
Drive
username
an
Credential
BITS
speed control
WSUS
Onedrive
search
google chrome
UK
blank page
internet Explorer
metric
interface metric
date
patch management agent
bginfo
LAN
Wake
environment
Dome Standard Agent
crash
kernal
same
the
within
a
your
on
WinRM
Setup
collecting
appropriate error
in
Erase
approve
EDR
delayed
ITSMService
Veeam
different
service
from
RAM Usage
Reaches
Value
Level
Log
RAM sockets
available
HTTPS
TCP
Port
Server
cis
autorun
Batch file
three
largest
pm
spm
rmm
availability
Power management
Ability
Connectivity
Virtual Private Network
VPN
online
Shutdown
unzip
24 hours
Success
Failed
virusscan
mcafee
public
installed
Trendmicro Antivirus
INTEL
AMT
Laptop
updates
KB
spooler
print
Action center
48
older
Web Page
Cdome
Trusted Root Certification Authorities store
Certificate
Motherboard
Health Status
Hard Drive
Changes
space
Threshold
Modify
host
screen
Legal
start menu
install comodo patch management agent
installed programs
Installed Programs and identifying number
property
remote
Transfer
SFTP
idle time
capacity
resize
activity
Hard disk
Smart
Missing
Font
Network Share
SCEP
System Center Endpoint Protection
Ownership
Recursively
Extension
clean
Find
Unhide
Empty
Rename
SHA1
Checksum
MD5
Modification
creation
time
last
File Modification
older than
UTC time
Projects
Corrupted
Copy
Blacklisted
root
Storage
Display
Top
Microsoft Installer
Recent
Windows Management Instrumentation Command
WMIC
Consuming
Last Logged on
already
restore
created
format
Delete partion
CCleaner
problems
Interrupt
saving
Kill
balanced
plan
Running
high
memory
maintenance
Kaspersky Security Center Agent
Critical
Kaspersky Endpoint Security 10
Kaspersky
defragmentation
auslogics
using
Defragment
Decompress
Compress
Background
Tool
commands
all
Demand
Task
summary
Recycle bin
Shared file
Task Scheduler
Clear
Cache
Renew
ESET
Desktop
Setting
BookMark
Mapped
Removable
Machine
Processor Architecture
Interaction
failure
Current User
Temporary
Local Group
days
open
Computer
updated
Guest User
Sophos
except
Path
remove
Byte
size
directory
Microsoft Essentials
Malwarebytes
TCP/IP
Folder
DHCP
Dynamic Host Configuration Protocol
Symantec
Sub Directory
All files
Dynamic IP
Text
content
specified path
Network Adapters
RDP
Remote Desktop connection
BitDefender Agent Security Tools
BitDefender
DNS
netman
Delete
Values
Registry-key
share folder
wireless network
License Status
Microsoft Office
Office
Microsoft
.NET 3.5 SP1
id
product
lisence
shortcut
Comodo Client Communication
operations
AVG CloudCare
AVG
Sub-keys
Browser history
volume
target
Teamviewer
WMI
statistics
usage
Anti-viruses
limit
quota
Popup Message
Task Bar
Quick Icon
restart
notifications
disconnected
logoff
logon
enabled
disabled
JRE
JDK
Java Development kit
Java Runtime Environment
Java
reboots
pending
infections
detected
uncleaned
certificates
expired
URL
Unauthorised
not
activated
License Key
Number
permissible
USER ACCESS CONTROL
UAC
triggers
actions
Multiple
changed
Local User
Environmental Variables
partition
stop
BIOS
startup
services
local
accounts
plug and play
run
reboot
drives
bitlocker
drivers
workstation
lock
restorepoint
performance
power
active
connections
ram
process
Guid
Comodo Client Security
patches
windows updates
Windows command
Python 2
Dome shield
hardware
servers
Security
Configurations
Process management
Script Procedures
Task automation
MSP automation
Script monitroing
Email
ITSM Procedures
Domain
User accounts
MSP
Log collection
integration
File operation
C1 automation
System opearations
Patch managment
MAC
Powershell
VB script
script
Remote managment
More
Play a specific audio in client
Download JSON
Download Python
json
Ratings
Release Time
08/30/2022
Downloads
362 times
Update Time
10/08/2024
Views
313 times
Share-it:
Categories
Action
Published on:
2 years ago
Tags
audio
Description
Screen Shots
Questions and Answers
Note:
Run as Logged user
Procedure's Instructions
import os import sys ps_content=r''' <# .Name EZT-AudioPlayer .Version 0.2 .SYNOPSIS Plays specified phrases with TTS and/or plays audio files from a specified folder/file path .DESCRIPTION .Configurable Variables: .EXAMPLE \EZT-AudioPlayer.ps1 .OUTPUTS System.Management.Automation.PSObject .Credits .NOTES Author: EZTechhelp #> #---------------------------------------------- #region Config Variables #---------------------------------------------- $text_to_Speak = "''' + itsm.getParameter('Text_to_Speak') + '''" #Pharse that should be spoken by TTS $text_to_Speech_Speed = "''' + itsm.getParameter('Text_to_Speech_Speed') + '''" #Speed of TTS. -10 is slowest, 10 is fastest, 0 is default/normal $Play_Audio_Path = "''' + itsm.getParameter('Play_Audio_Path') + '''" #Full path to a single audio file or folder containing audio files $Play_Audio_Filter = "''' + itsm.getParameter('Play_Audio_Filter') + '''" #specify the audio file names, formats or other filters that are allowed to be played, comma seperated. Supported format depends on what is supported by Windows Media Player $Shuffle = "''' + itsm.getParameter('Shuffle') + '''" # 1 = Enable Random Shuffle when playing multiple audio files, 0 (or anything else) = Disable #---------------------------------------------- #endregion Config Variables #---------------------------------------------- #---------------------------------------------- #region Show-NotifyBallon Function #---------------------------------------------- Function Show-NotifyBalloon($Message) { [system.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | Out-Null $Global:Balloon = New-Object System.Windows.Forms.NotifyIcon $Balloon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon((Get-Process -id $pid | Select-Object -ExpandProperty Path)) $Balloon.BalloonTipIcon = 'Info' $Balloon.BalloonTipText = $Message $Balloon.BalloonTipTitle = 'Now Playing' $Balloon.Visible = $true $Balloon.ShowBalloonTip(1000) } #---------------------------------------------- #endregion Show-NotifyBallon Function #---------------------------------------------- #---------------------------------------------- #region Get-SongInfo Function #---------------------------------------------- Function Get-SongInfo($FullName) { $Shell = New-Object -COMObject Shell.Application $Folder = $shell.Namespace($(Split-Path $FullName)) $File = $Folder.ParseName($(Split-Path $FullName -Leaf)) [int]$h, [int]$m, [int]$s = ($Folder.GetDetailsOf($File, 27)).split(":") $Artist = ($Folder.GetDetailsOf($File, 13)) $title = ($Folder.GetDetailsOf($File, 21)) $album = ($Folder.GetDetailsOf($File, 14)) $year = ($Folder.GetDetailsOf($File, 15)) $Genre = ($Folder.GetDetailsOf($File, 16)) $length = $h*60*60 + $m*60 +$s $meta_properties_output = New-Object -TypeName 'System.Collections.ArrayList' $newRow = New-Object PsObject -Property @{ 'Artist' = $Artist 'Title' = $title 'Album' = $album 'Year' = $year 'Genre' = $Genre 'Length' = $length } $null = $meta_properties_output.Add($newRow) Write-Output $meta_properties_output } #---------------------------------------------- #endregion Get-SongInfo Function #---------------------------------------------- #---------------------------------------------- #region Start-AudioPlayer Function #---------------------------------------------- Function Start-AudioPlayer { param ( $Play_Audio_Path, $Play_Audio_Filter, [int]$Shuffle, [switch]$Stop ) Add-Type -AssemblyName presentationCore $mediaPlayer = New-Object System.Windows.Media.MediaPlayer if($Stop) { $mediaPlayer.Stop() $mediaPlayer.Close() return $null } if(!$Play_Audio_Filter) { $Play_Audio_Filter = "*" } if(Test-Path -LiteralPath $Play_Audio_Path) { $musicFiles = Get-ChildItem -LiteralPath $Play_Audio_Path -include $Play_Audio_Filter -recurse | select name,fullname,BaseName,DirectoryName,Extension,@{n='Duration';e={(get-songinfo $_.fullname).length}} } else { Write-Warning "The provided audio file path is not valid, does not exist, or no files matched the provided filters" exit } $FileCount = $musicFiles.count $TotalPlayDuration = [Math]::Round(($musicFiles.duration | measure -Sum).sum /60) if($Shuffle -eq 1) { $Mode = "Shuffle" $musicFiles = $musicFiles | Sort-Object {Get-Random} # Find the target Music Files and sort them Randomly } Else { $Mode = "Sequential" } write-host "[$(Get-Date)] Number of audio files to be played: $FileCount" write-host "[$(Get-Date)] Total play duration: $TotalPlayDuration minutes" foreach($file in $musicFiles) { $meta_properties = get-songinfo $($file.fullname) write-host "`n[$(Get-Date)] Now playing: $($meta_properties.artist) - $($meta_properties.title)" write-host "[$(Get-Date)] | File: $($file.Name)" $mediaPlayer.open([uri]"$($file.fullname)") Start-Sleep 2 $duration_sec = $mediaPlayer.NaturalDuration.TimeSpan.TotalSeconds $duration_sec_round = [Math]::Round($mediaPlayer.NaturalDuration.TimeSpan.Seconds) $duration_min = $mediaPlayer.NaturalDuration.TimeSpan.Minutes $Message = "Song : $($meta_properties.artist) - $($meta_properties.title)`nPlay Duration : $($duration_min) Mins $($duration_sec_round) Sec`nMode : $Mode" Show-NotifyBalloon -Message $Message write-host "[$(Get-Date)] | Duration: $($duration_min) Mins $($duration_sec_round) Sec" $mediaPlayer.Play() while ($duration_sec -ge 0) { Write-Progress -Activity "Now Playing: $($meta_properties.artist) - $($meta_properties.title)" -SecondsRemaining $duration_sec -Verbose start-sleep 1 $duration_sec -= 1 } $mediaPlayer.Stop() write-host "[$(Get-Date)] | $($file.BaseName) has finished playing" } $mediaPlayer.Close() } #---------------------------------------------- #endregion Start-AudioPlayer Function #---------------------------------------------- #---------------------------------------------- #region Play TTS #---------------------------------------------- if($text_to_Speak) { write-host "#### Playing Text-to-Speech ####" -ForegroundColor Yellow Add-Type -AssemblyName System.speech $tts = New-Object System.Speech.Synthesis.SpeechSynthesizer $tts.Rate = $text_to_Speech_Speed write-host "[$(Get-Date)] Speaking Phrase: $text_to_Speak" write-host "[$(Get-Date)] Speech Speed: $text_to_Speech_Speed" $tts.Speak($text_to_Speak) write-host "[$(Get-Date)] Text to speech ended`n" } #---------------------------------------------- #endregion Play TTS #---------------------------------------------- #---------------------------------------------- #region Play Audio #---------------------------------------------- if($Play_Audio_Path) { write-host "#### Starting Audio Player ####" -ForegroundColor Yellow Start-AudioPlayer -Play_Audio_Path $Play_Audio_Path -Play_Audio_Filter $Play_Audio_Filter -Shuffle:$Shuffle } #---------------------------------------------- #endregion Play Audio #---------------------------------------------- ''' print ("iTarian RMM- Executing Powershell Script") def ecmd(command): import ctypes from subprocess import PIPE, Popen class disable_file_system_redirection: _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection def __enter__(self): self.old_value = ctypes.c_long() self.success = self._disable(ctypes.byref(self.old_value)) def __exit__(self, type, value, traceback): if self.success: self._revert(self.old_value) with disable_file_system_redirection(): obj = Popen(command, shell = True, stdout = PIPE, stderr = PIPE) out, err = obj.communicate() ret=obj.returncode if ret==0: if out: return out.strip() else: return ret else: if err: return err.strip() else: return ret file_name='EZT-AudioPlayer.ps1' file_path=os.path.join(os.environ['TEMP'], file_name) with open(file_path, 'wb') as wr: wr.write(ps_content) ecmd('powershell "Set-ExecutionPolicy RemoteSigned"') print ecmd('powershell "%s"'%file_path) os.remove(file_path)
Comments
No Comments.
Leave a Comment
Email
Comment
Send
×
×
CONTACT US
Call now!
(972) 649-9012
Products
*
Select a product...
Comodo One
RMM
Service Desk
Patch Management
Name
*
Email Address
*
Contact Number
*
Company Name
*
Country
*
Select your country...
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antartica
Antigua and Barbuda
Argentina
Armenia
Aruba
Australia
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belgium
Belize
Benin
Bermuda
Bhutan
Bolivia
Bosnia and Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean territory
Brunei
Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Canada
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
CongoCongo, Democratic Republic
Cook Islands
Costa Rica
Cote d'Ivoire (Ivory Coast)
Croatia (Hrvatska)
Cuba
Cyprus
Czech Republic
Denmark
Djibouti
Dominica
Dominican Republic
East Timor
Ecuador
EgyptEl Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guinea
Guinea-Bissau
Guyana
Haiti
Heard and McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
India
Indonesia
Iran
Iraq
Ireland
Israel
Italy
Jamaica
Japan
Jordan
Kazakhstan
Kenya
Kiribati
Korea (north)
Korea (south)
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Libyan Arab Jamahiriya
Liechtenstein
Lithuania
Luxembourg
Macao
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia
Moldova
Monaco
Mongolia
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
Northern Mariana Islands
Norway
Oman
Pakistan
Palau
Palestinian Territories
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Réunion
Romania
Russian Federation
Rwanda
Saint Helena
Saint Kitts and Nevis
Saint Lucia
Saint Pierre and Miquelon
Saint Vincent and the Grenadines
SamoaSan Marino
Sao Tome and Principe
Saudi Arabia
Senegal
Serbia and Montenegro
Seychelles
Sierra Leone
Singapore
Slovakia
Slovenia
Solomon Islands
Somalia
South Africa
Spain
Sri Lanka
Sudan
Suriname
Svalbard and Jan Mayen Islands
Swaziland
Sweden
Switzerland
Syria
Taiwan
Tajikistan
Tanzania
Thailand
Togo
Tokelau
Tonga
Trinidad and Tobago
Tunisia
Turkey
Turkmenistan
Turks and Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United Kingdom
United States
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (US)
Wallis and Futuna Islands
Western Sahara
Yemen
Zaire
Zambia
Zimbabwe
Message
*
Click here to
reload above text.
---
Comments