Forum Discussion

CS_HelpDesk's avatar
CS_HelpDesk
GoTo Contributor
2 years ago

Remote Execution - PowerShell Script Repository

Welcome to the Remote Execution - Powershell Script Repository!

 

What is it? A library of scripts to help you execute automated tasks and manage your Central computers without having to access them manually.
 
How does it work? Simply browse the replies below, copy and paste to the Remote Execution job screen in your Central console. 
 
How can you help? We encourage you to share your own scripts and/or help review the scripts of others-- just "Kudo" your favorites or reply with your comments. 
 
Use of these scripts is at your own risk so please test them on a small number of systems before deploying at scale. The scripts are provided “as is” without any warranty of any kind and GoTo , Inc disclaims any and all liability regarding any use of the scripts.  Please see the following Terms and Conditions for more information.
 
Remember: The currently running Remote Execution script ends when either the host service stops or the script includes computer shutdown or reboot tasks.
 

 

  • CS_HelpDesk's avatar
    CS_HelpDesk
    GoTo Contributor

    Update Windows Security signatures.

    ---

    & "$env:ProgramFiles\Windows Defender\MpCmdRun.exe" -SignatureUpdate
  • CS_HelpDesk's avatar
    CS_HelpDesk
    GoTo Contributor

    Starting a service PowerShell script.

    ---

    $service = $null

    $s = Get-Service $service

    if ($s.Status -eq 'stopped')
    {
      Start-Service -InputObject $s -PassThru
    }
  • CS_HelpDesk's avatar
    CS_HelpDesk
    GoTo Contributor
    Stopping a service PowerShell script.
    ---
    $service = $null

    $s = Get-Service $service

    if ($s.Status -eq 'running')
    {
      Stop-Service -InputObject $s -PassThru
    }
  • CS_HelpDesk's avatar
    CS_HelpDesk
    GoTo Contributor

    Restarting a service PowerShell script.

    ---

    $service = $null

    $s = Get-Service $service
    Restart-Service -InputObject $s -PassThru
  • CS_HelpDesk's avatar
    CS_HelpDesk
    GoTo Contributor

    Upload a .reg file that will be silently imported.

    ---

    $file = $resolve_Files[0];
    reg import $file;
  • CS_HelpDesk's avatar
    CS_HelpDesk
    GoTo Contributor
    Clears the contents of the DNS client cache.
    ---
    Clear-DnsClientCache
  • CS_HelpDesk's avatar
    CS_HelpDesk
    GoTo Contributor

    This example is to add a LogMeIn Access Code as a remote access password option; It can also be used to add any Windows profile name such as “Administrator” or "First Name LastName". 

     

    Many technicians use this option to create the LogMeInRemoteUser for quicker One2Many task deployment and execution.

     

    Script to add a Windows Profile: 

    net user LogMeInRemoteUser Test1234 /ADD  

    net localgroup administrators LogMeInRemoteUser /add  

     

    Test1234 is a password example, and it must be 8 characters long. You can enter whatever password you want, thus creating the "Access Code".