Announcement

Collapse
No announcement yet.

Anydesk Delete Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Anydesk Delete Script

    Hello,

    I want to uninstall AnyDesk programs (all versions) installed on computers. Can you write a script similar to the Script file you have written to uninstall Teamviewer programs?


    CODE:
    Code:
    #To define a particular parameter, replace the 'parameterName' inside itsm.getParameter('parameterName') with that parameter's name
    drive = itsm.getParameter('Drive') #Provide the drive which you need to find files eg: "c:"
    
    import os
    import sys
    import ctypes
    
    def alert(arg):
    sys.stderr.write("%d%d%d" % (arg, arg, arg))
    
    ps_content=r'''
    $time = (Get-Date).AddMinutes(-30)
    $size = 300MB
    Get-ChildItem %s\ -Recurse | Where-Object {$_.CreationTime -gt $time -and $_.Length -gt $size}
    '''%(drive)
    
    import os
    
    def ecmd(command):
    import ctypes
    from subprocess import PIPE, Popen
    
    class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirect ion
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirecti on
    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:
    alert(1)
    return out.strip()
    else:
    alert(0)
    return ret
    else:
    if err:
    return err.strip()
    else:
    return ret
    
    file_name='powershell_file.ps1'
    file_path=os.path.join(os.environ['TEMP'], file_name)
    print file_path
    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)

  • #2
    Hi hguler07,

    Thanks for your script request. We have asked our script developers to analyse and provide feedback.

    Kind Regards,
    PremJK

    Comment


    • #3
      Hi hguler07,

      Please try this script prepared by our script developers and provide your feedback
      https://scripts.itarian.com/frontend...sk-application

      Kind Regards,
      PremJK

      Comment


      • #4
        Hello,

        We tested the script and it works fine. Thank you very much.

        Kind Regards,

        Comment

        Working...
        X