Jump to content

Search the Community

Showing results for tags 'powershell'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • MSPGeek
    • Announcements
    • The Geek Cast
  • ConnectWise Automate / Labtech
    • ConnectWise Automate / LabTech
    • ConnectWise Automate / LabTech - Development

Categories

  • ConnectWise Automate
    • Scripts
    • Plugins
    • SQL Snippets
    • Role Definitions
    • Automate PowerShell Code
    • Reports
    • Internal Monitors
    • Remote Monitors
  • ConnectWise Manage
    • API Interacting Code

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


Agent Count


INTERESTS


OCCUPATION


ICQ


WEBSITE


WLM


YAHOO


AOL


FACEBOOK


GOOGLEPLUS


SKYPE


TWITTER


YOUTUBE

Found 10 results

  1. My Script that i wrote for Automate deploys a ps1 file and runs it as admin. But the script appears to run under Local admin credentials because "$env:LogonServer" doesn't expand to the actual logon server for the site. It expands to "C:\" The reason im using this approach is that i want the script to be compatible for all our client sites. The domain admin credentials are in the sites "Passwords" section and all the defaults are set to run things under those credentials but i still cant get that variable to expand properly
  2. DarrenWhite99

    PowerShell Deployment Scripts

    Version 1.0.4

    213 downloads

    I used the stock PowerShell 2.0 update script, and modified it for PowerShell 3, 4, and 5. I attempted to cover pre-requisites checks to prevent installing on systems with incompatible applications or operating systems. The scripts will check if the KB is reported as installed after the update completes to determine status. This means that the script will report the update was successful even if a reboot is still needed. The attached .ZIP has 3 scripts, one for each version, in a single XML bundle. To import the Scripts, select Tools -> Import -> XML Expansion. After import the scripts should appear in the "__Examples" folder. This pairs nicely with the PowerShell Version Roles at https://www.labtechgeek.com/files/file/13-powershell-version-roles/
  3. mr.wallstrom

    Script Sleep question

    If Automate script fires off a powershell PS1 file on the local host, will the next line in the Automate script wait for that PS1 file to finish executing, or will it move to the next Automate script line right after that PS1 was launched? I need my Automate script to 'sleep' until the PS1 file completes its' task (which creates a local log file.) Problem is, that PS1 file could take anywhere from a few minutes, to several hours, to finish. (The PS commands need to be run elevated, which is why I am using a local file; couldn't figure out how to elevate from Automate, but was able to find code I can put in the local PS1 script head, that will automatically re-launch itself into elevated session.) Thanks, Michael
  4. p_ern

    Scripted Diagram

    Hello all fellow geekers. I´ve scripted a sort of automated diagram , with the help of a Powershell module made by Kevin Marquette. This was made as a way to learn Powershell and as a proof of concept for myself that it can be done. So if its a bit crude and unrefined, thats why. You also need graphviz for this to work.Follow the instructions on Kevins Github on how to install. It consist of two parts , The script itself and a csv. The data is pulled from a dataview with certain columns. I feel like it is ready enough to release for you folks to see if we can improve upon it. I have it on my Github here with instructions on how to use it. Enjoy!
  5. mr.wallstrom

    Trouble with security settings

    Hello, I'm having a lot of issues around security access denied messages lately. I've beaten myself up every which way with UAC, and enabling the local token filter policy in the registry. Attempting to use wmic commands, powershell (ver 2 and ver3) and keep getting hit with the access denied, return code 5, etc. When you run a command from the Tools - CMD prompt, I need to know - does this actually run from the local agent, and therefore as a 'local' command, or does it actually run from another machine, and therefore is 'remote'?? I have been trying to use this method to test out the commands lately, since they also fail from the script. Running them from the cmd tools menu is faster that re-editing the script each failure. What am I actually trying to run? A simple rename computer command. I've tried several variants of it. The only one I have NOT tried yet, is to use one that allows me to also submit the domain credentials for an account authorized to change the PC's hostname on a domain. On this note, is there a way to pass the domain credentials into the powershell script using the labtech script parameters? So that a tech can be required to enter in the needed credentials each time the script is run? (I was trying to turn the PS commands I found for this into a single line. Could be that is where I'm going wrong here.) I tried using -DomainCredential, followed by manually entering in domain\user, password, but this failed as well. I have seen some 3 line code examples that break down the -DomainCredential into pieces, and then concatenates them together - the only direction I haven't tried, that I have seen. This was my last attempt, from the tools cmd: %windir%\system32> ~RENAME-COMPUTER admin10 -force -PassThru RENAME-COMPUTER : Fail to rename computer 'admbx10' to 'admin10' due to the following exception: Access is denied. At line:1 char:1 + RENAME-COMPUTER admin10 -force -PassThru + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (admbx10:String) [Rename-Compu ter], InvalidOperationException + FullyQualifiedErrorId : FailToRenameComputer,Microsoft.PowerShell.Comman ds.RenameComputerCommand HasSucceeded OldComputerName NewComputerName ------------ --------------- --------------- False admbx10 admin10 Any tips? Thanks in advance.
  6. DarrenWhite99

    Contribution :PowerShell Deployment Scripts

    View File PowerShell Deployment Scripts I used the stock PowerShell 2.0 update script, and modified it for PowerShell 3, 4, and 5. I attempted to cover pre-requisites checks to prevent installing on systems with incompatible applications or operating systems. The scripts will check if the KB is reported as installed after the update completes to determine status. This means that the script will report the update was successful even if a reboot is still needed. The attached .ZIP has 3 scripts, one for each version, in a single XML bundle. To import the Scripts, select Tools -> Import -> XML Expansion. After import the scripts should appear in the "__Examples" folder. This pairs nicely with the PowerShell Version Roles at https://www.labtechgeek.com/files/file/13-powershell-version-roles/ Submitter DarrenWhite99 Submitted 03/06/18 Category Scripts  
  7. Hey Everyone, Trying to run a script on Exchange servers that runs a Get-Mailbox command but having trouble getting the script to run successfully. I believe my issue is the script is running powershell but failing because powershell and Exchange Management Shell are slightly different since EMS loads Exchange commands and Powershell does not. Has anyone had success running Exchange commands from Automate Scripts on Exchange servers? Any helpful hints or tips is much appreciated. FYI, I am trying to run a script that removes mobile devices that have not synced 180 days+. I have the EMS command that can accomplish this my only issue seems to be getting the script to run the command in EMS and not Powershell. Thanks!
  8. EssentialSteve

    Passing variables between scripts

    Hi there, I'm stuck on how to return a variable from a powershell script, and then use it in the next part of the main script. The whole script is for clearing the browser cache. The first part does the clearing, which is going ok. This creates a report with the date. Then I want to find the newest report file, which I'm doing with this powershell script: $dir = "C:\Windows\LTSvc\Reports" $latest = Get-ChildItem -Path $dir | Sort-Object LastAccessTime -Descending | Select-Object -First 1 $latest.name So $latest.name is the name of the newest file. I'm running this script from Labtech's 'Execute Script' function, Run as Admin with the Variable: NewFileName The next line in the main script, I echo @NewFileName@ and get the correct result. Then in the following line I have Ticket Attach File, and the file path I have is: C:\Windows\LTsvc\Reports\@NewFileName@ ... but it fails saying "Invalid file for ticket attach file". What am I doing wrong here? Thanks in advance, Steve.
  9. EssentialSteve

    Run PowerShell as Admin

    Hi there, I'm having problems running a powershell script as Admin. I've got a script which creates a folder, writes the data to a powershell file, and then runs Shell as Admin: C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy ByPass -File "C:\Windows\LTSvc\EIT_Repository\Scripts\browser-clear.ps1" After this line I have: ECHO Result: %shellresult% And the result of this line is the same as if I were to run this file in a normal powershell window (not Administrator), which leads me to believe that for some reason the above line is not running as Admin. I have created a two line powershell script, which I mentioned here: ... and this all worked fine (in the end!) - which is confusing me now, as I would have thought a longer script should execute the same way. How would I go about troubleshooting the issue I have now? Are there more debugging options I can put in? Thanks in advance, Steve.
  10. DarrenWhite99

    PowerShell Version Roles

    Version 1.0.1

    171 downloads

    This bundle will add the following Role Definition: PowerShell And the following Sub-Definitions: PowerShell 1 PowerShell 2 PowerShell 3 PowerShell 4 PowerShell 5 PowerShell 6 To import these Role Definitions, in the ConnectWise Automate main screen, go to Tools > Import -> SQL File. Browse to the relevant file, and OK the message about inserting 7 rows.
×