Hello! I wish to know how to run script of powershell using an administrator account, thank you guys!
Hi @Rincat
Please try to clone below-mentioned procedure,
This script procedure creates temporary PowerShell script file (.ps1 format), run it, capture the output and delete it.
Replace variable content of “powershell_script” with your custom script (in-between triple quotes)
powershell_script=r""“your custom PowerShell instructions “””
import os
import ctypes
powershell_script=r"""
$IPType = "IPv4"
$adapter = Get-NetAdapter | ? {$_.Status -eq "up"}
$interface = $adapter | Get-NetIPInterface -AddressFamily $IPType
If ($interface.Dhcp -eq "Disabled") {
# Remove existing gateway
If (($interface | Get-NetIPConfiguration).Ipv4DefaultGateway) {
$interface | Remove-NetRoute -Confirm:$false
}
# Enable DHCP
$interface | Set-NetIPInterface -DHCP Enabled
# Configure the DNS Servers automatically
$interface | Set-DnsClientServerAddress -ResetServerAddresses
}"""
workdir=os.environ['PROGRAMDATA']+r' emp'
if not os.path.isdir(workdir):
os.mkdir(workdir)
fobj=open(workdir+r'\autorun_powershell.ps1',"w")
fobj.write(powershell_script)
fobj.close()
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():
out=os.popen(r'powershell.exe -executionpolicy bypass -file "'+workdir+r'\autorun_powershell.ps1"').read();
print(out)
os.remove(workdir+r'\autorun_powershell.ps1')
Let us know your feedback
The “Get Physical Disk Drive Information” gives us the information I’m looking for, is there a way that I can run it against all systems and get the information in a report/csv either as a report or have a ticket generated if the results do not match a string? I want to know the type of HDD in all the systems so that we can evaluate how many SSDs we need to buy. Checking each system individually would take a significant amount of time, comparatively.
Hi @TimBWatkins,
Thank you for writing the request, We will analyze let you know the Script as soon as possible.
I have a request for a monitoring script, as well as a remediation for the monitor. I would like to be able to monitor to check if Adobe Reader, or Acrobat, is the default PDF viewer, and if it isn’t, change it so that it is.
It would be amazing to have a script that automates installing fonts across a network. Cheers guys!
Hi @WHodgkinson
Yes sure, we can provide a script to install fonts from a network share. I will update you once done.
Thanks
It would be amazing to have a script that automates installing fonts across a network. Cheers guys!
Hi @WHodgkinson,
Please check the script to install fonts from the network share
Hi !
I’m new here! But i consider that your work is great. I´m implementing comodo´s solutions to my SGSI.
I need a script that alert (create a ticket in service desk) when the smart status of the principal harddrive go bad.
I have seen a script in the forum that uses wmic harddisk get status but the OK response on a test disk not seems to be correct if i compare with CristalDisk Software for example.
We are glad to welcome you here. We are working on a SMART monitoring script. I will update you once done.
Thanks,
Kannan
Please use the script for your request now and let us know your feedback as well.
Thank you.
copy a whole Directory from a Client to Server.
I just found a script to copy a file from folder to another. But i would like to copy a whole directory to a shared folder.
Can you help me with this?
Thank you.
Hi @Everton Nogueira,
Please refer this script for copying a directory to the network share.
https://forum.mspconsortium.com/foru…-network-share
https://scripts.comodo.com/frontend/web/topic/copy-a-directory-to-network-share
How about a script for deploying the SSL certificate thats now available in Dome 1.9?
Hi
i need script to send report via Email
this report should include the following information :
- 2x a day browser reports. (we want to see if a certain user is tampering with things)
- mouse/keyboard idle script
- change of settings , something that can show if someone made changes on computer settings
Thanks .
Hi @aghiad
Thank you for contacting us for the script requirement. We will come up with the best script and update you.
How about a procedure for clearing the print spooler?
Edit: Nevermind…lol I found it, It’s called Printer Pool
Script to uninstall specific KB from a computer.