Jump to content

Search the Community

Showing results for tags 'scripting'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • MSPGeek
    • The Geek Cast
    • Code of Conduct
  • 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


About Me


Location


Agent Count


INTERESTS


OCCUPATION


ICQ


WEBSITE


WLM


YAHOO


AOL


FACEBOOK


GOOGLEPLUS


SKYPE


TWITTER


YOUTUBE

Found 20 results

  1. I'm starting to write scripts which does trivial things like get SQL Server error logs and job logs using the SMO .NET class. My hurdle is that as a remote monitor runs in the NT AUTHORITY\SYSTEM context, in modern versions of SQL Server, the system does not have access to any of the SQL instances. I could give NT AUTHORITY\SYSTEM sysadmin role again, but it was removed by Microsoft as a default for a good security reason. How does or would anyone else tackle this? I'm now thinking of either: (somehow) changing the security context of the service the agent runs as, although maybe this might break stuff? e.g. trying to access protected stuff which require UAC or something - turning UAC off isn't ideal Use Scheduled Scripts and use the run as admin function(s) in the scripting engine so I can use admin credentials in the agent's Location, but this might also cause issues if UAC enabled I haven't actually tested either of the above approaches. Figured I'd spark a conversation while I start testing.
  2. Hey all, Attached are two scripts. "EXAMPLE - IT Glue Credentials" - This could easily be a scriptlet as well, but you could pretend this would be any other script where you would want to have credentials from IT Glue to do something with them. This script then calls... "FUNCTION - Retrieve IT Glue Credentials" - This is the script that does the work to go off and pull the credentials from IT Glue Assumptions You're syncing Automate and IT Glue, or at least have the names of your clients in IT Glue exactly match those in Automate. You have an Enterprise IT Glue plan Things you need to do before using Step 4 in "EXAMPLE - IT Glue Credentials" - This variable needs to be set to the exact name of the password you want to pull from IT Glue. Limitation here is that you need consistency in your password naming - we use a PowerShell script to pre-populate various password records for ones we'd want to pull into Automate Step 4 in "FUNCTION - Retreive ITGlue Credentials" - This query needs to be updated with a 'centralised' Server that you want to run the PowerShell from that goes off to do the IT Glue query. This was so I knew PowerShell versions wouldn't get in the way of the script and that my IT Glue API key wasn't being exposed to hundreds of servers. Step 6 in "FUNCTION - Retreive ITGlue Credentials" - This PowerShell script needs to be updated with your IT Glue URI and your API Key. This API Key obviously needs the Password Access box ticked... What you should then have at the end of it are two variables, @username@ and @password@ - You can then use these in your Automate script. There is some basic error checking built in - one for if it simply can't find the credentials, and one for if the PowerShell command fails for some reason. These are then tied to Script GoTo's in the EXAMPLE script that you can then log off of if you wish. FUNCTION - Retreive ITGlue Credentials.xml EXAMPLE - IT Glue Credentials.xml
  3. So, I have a really cool and useful script I found posted here and it works fantastically for a majority of sites. Unfortunately it doesn't yet work at all sites because at some places there is more than one domain controller. At those sites, only one of the multi-DC's has the AD Domain Naming Master role, but also only one has the NTDS role - so I am confused as to why the script cannot correctly identity this and select just 1 DC from 2 or 3 when c.RoleName = "AD Domain Naming Master" Is there an easier way to single out systems based on roles installed? OG post for more info
  4. I'm looking for some feedback on if what I'm trying to accomplish is even possible at this point. I have an Automate script that is running a PowerShell script. I want the Automate script to pass an input parameter provided at runtime into the PowerShell script which, in turn, uses that input as a parameter on a PowerShell cmdlet inside the PowerShell script. I know that the PowerShell script as written works to do what I want it to do but I'm trying to make it so that the PS script doesn't have to be manually modified every time it needs to be run. And if this isn't obvious not a strong Automate scripter here so I could be all jacked up and not even know it. What the script is doing is creating a scheduled task inside Windows. The parameter I'm trying to pass is to designate the -At parameter to the New-ScheduledTaskTrigger cmdlet. All the normal stuff is in place. Function: Execute Script Script Type: Powershell Bypass Script to Execute: contains text of PS script Script Parameters: Blank. But this has been tried with various iterations like @timetorun@ and %timetorun%. (TimetoRun being the parameter I have defined on the Automate script.) Script Credentials: Run as Admin Variable: Blank. 1. Is what I'm trying to do possible? If so, how do I set up the Automate script as well as what modifications, if any, are needed inside the PowerShell script? 2. Is this documented somewhere in docs.connectwise.com? The documentation I found didn't really go into what I'm specifically trying to do and so I'm thinking my use case may be unique.
  5. So I have been combing through the forum here for a while looking for examples of how people have scripted local admin account setups. I have built out a script to do all of those tasks but wanted to customize the @Password@ variable in some way so that the script could reference a client-specific local admin password. This way ALL the PCs I manage don't have the same local admin pw. Is there an intuitive way to do this with EDF's etc? I can't even find where I would put in a Client EDF and which script function to use for this. I feel like they are right in front of my eyes. What am I missing? Anyone else have a different setup for creating different local admin passwords via scripts? I don't want a different script for each client unless there is no other choice, but I feel like fetching an edf value that has that pw would be perfect, just not clear on the details. Any help would be awesome.
  6. Hello All, New to this community and scripting in CWA itself, I am trying to create a script that will copy files as admin from source to target. Every time I try the debugger it fails to find the network location, has anyone had issues with this is in the past. The share not being found, I have confirmed it shared out with Everyone to rule out permissions. Thanks
  7. Has anyone been able to give clients access to their own scripts. This is so they can create their own and run there own but not see ones we have been creating/using
  8. Hi All, After speaking with ConnectWise, I understand there is a script from the Solution Centre called 'Windows 10 - Install Feature Update' which requires you to deploy the latest build of Windows 10 to your LTShare, but that it's only a supported feature on-prem and cloud partners currently don't have support for this.. https://docs.connectwise.com/ConnectWise_Automate/ConnectWise_Automate_Knowledge_Base_Articles/Scripting%3A_Windows_10_Install_Feature_Update_Script As a potential workaround, ConnectWise have told me I can individually place the ISO under the LTsvc\packages folder on each machine. Rather than download 50 x 4GB ISO's for a client, I thought to use the server to then have Automate copy this locally, but I'm struggling. My plan was to create an EDF whereby we can enter at the location level the path to the ISO and then call this in a variable for the Script copy as Admin but it doesn't seem to unpack the variable path and the script fails. Has anybody else had any success upgrading from 1803/1809/1903 using Automate? Any help would be appreciated!
  9. Hoping someone can help me create a script. The script requires a selection on one window to select 64 or 32 bit installation as well as the installation key to move forward. I have worked over 10 hours trying to get anything to work on this- I'd really hate to manually have to install the application on each system that needs it. I can provide the .exe file is someone thinks they can assist me? Thank you so much! Krissy
  10. Hi All, After speaking with ConnectWise, I understand there is a script from the Solution Centre called 'Windows 10 - Install Feature Update' which requires you to deploy the latest build of Windows 10 to your LTShare, but that it's only a supported feature on-prem and cloud partners currently don't have support for this.. https://docs.connectwise.com/ConnectWise_Automate/ConnectWise_Automate_Knowledge_Base_Articles/Scripting%3A_Windows_10_Install_Feature_Update_Script As a potential workaround, ConnectWise have told me I can individually place the ISO under the LTsvc\packages folder on each machine. Rather than download 50 x 4GB ISO's for a client, I thought to use the server to then have Automate copy this locally, but I'm struggling. My plan was to create an EDF whereby we can enter at the location level the path to the ISO and then call this in a variable for the Script copy as Admin but it doesn't seem to unpack the variable path and the script fails. Has anybody else had any success upgrading from 1803/1809/1903 using Automate? Any help would be appreciated!
  11. Hello! I am looking for some advice on scripting a Rapidfire Network Detective domain, and local PC scans. We have several customers we utilize Network Detective on, and would like to create one script to run at all locations. I could use some help with the logic of this, and how it may work. This is what I have so far. Run Network Detective application first time and save the settings in a common location (C:\Rapidfire) Run the saved settings in a Automate script that executes a batch as an admin. (This seems to be working) Run the local data collector on workstations in the domain (should I do this via batch as well, could I call this in the original script?) Pull the results file, and upload them to the cloud or a server off site. Any help you could provide with this would be great! Also if you have any good resources on creating scripts, I'd love to see them.
  12. I'm trying to use a script that downloads and installs/runs Dell Command Update. In order to do this, I need to put the 'Dell-Command-Update_2.4.0.exe' on the LTShare in "LTshare\Software\Dell Command Update\." I'm able to download any file that is placed into an already existing directory, but when I try to create a new directory and place the installer in there, it won't let me download the installer. Server Error: 404 - File or directory not found. I've already tried rebooting our Automate server and that did nothing. Any ideas as to why it won't let me download from a new directory?
  13. Hello, Starting from this great Thread. I am looking at ways to manage computers power plan settings. I tested the scripts from that thread and they generally all worked out of the box I think they were built pre version 12 so I did have to make changes to 1 script line once imported to Automate. My question is on how best to manage when those scripts get applied. I would like to do an AutoJoin Search Group but talking with CW support they say there is no way to use custom SQL Queries as part of Automates "Search" function. What options do I have for creating custom "searches" or creating something equivalent that I can put schedules against? My Background: I've worked with Automate for 5 years in a support role I'm now shifting my focus to Automate Development and am so happy to find this community.
  14. Hi all, New to Automate and learning to handle its vast capabilities of automation. I have a monitor that checks for devices not discovered on the network for a setting time period e.g. 7days. It works fine it sends an email to the registered email in the alert template when a new device is discovered. However I want to improve the automation with this monitor/alert/script. I would like to create a script that when the monitor is trigger the alert runs. I want this script to collate a list of the devices by "client/location" generated from the monitor and rather than send individual repeated emails to same client(email field) I would like it to input all the devices not seen for more than eg 7days into the automate email and email the client(selected email field). I had a look at running a search and creating search groups but it seems like this would lead to various obstacles. I believe their should be a way to script what I want automate to do so It looks up the list of devices, looks up the client name, groups it and emails it to the contact for that client. Not sure if that make sense. Thanks in advance.
  15. If a function script exits in failure, the parent script does not detect this. When calling "Script Run", only a failure to start the subscript is considered a failure. By using a specific/known variable in your scripts, you can detect when a subscript has failed. But this requires specific steps in both the Parent and the Child script to accomplish. Refer to the picture below for context, but you can do it like this: In the Parent Script, set a known variable, @exitonfailure@ to a good value (0) just before calling the function script. (Parent Script, Step 18) In the Function Script, set @exitonfailure@=0 if the script was successful, set @exitonfailure@=1 if the script failed. If you want to detect any abnormal exit, set @exitonfailure@=1 until "success" has been reached. - Optional - (Subscript, Step 1) When a script exit would no longer be considered a failure set @exitonfailure@=0. (This could be many steps before the subscript exits, but at this point nothing will be considered a failure. Subscript, Step 27, Exit in Step 34) If you want to detect a specific failure condition, set @exitonfailure@=1 when the script has definitely failed. (Subscript, Step 39, Exit in step 40) In the Parent Script, check if @exitonfailure@ is set to the good value "0" (Parent Script, Step 20), and jump over a "Script Exit with Error" step (Parent Script, Step 21). If instead of immediately calling "Script Exit with Error" you jump to a label, it could be done in 1 step by jumping to a label (:EndFailure for example) if @exitonfailure@ is NOT set to 0. I like setting @exitonfailure@=1 to start the function script and ONLY setting back to good once I have reached a "good" state. That way ANY failure, even failure on steps I didn't anticipate, will be detected as a failure of the script. If you only want a specific fault to be the "failed" case, then wait to set the variable to 1 until right before exiting in failure. That way unexpected crashes, etc. would not be considered bad, only the specific "bad" scenario would be detected as a failure.. Keywords: report function subscript error failure status child parent script detect
  16. This a question we get asked quite often in the LabTech Geek Slack so figured I'd put up this post to show numerous examples and ideas for how to achieve this: https://gavsto.com/running-programs-scripts-as-a-logged-in-user-in-a-labtech-automate-script/ Hope it helps. TIP: You can make this appear in any channel in the LabTech Geek Slack by typing !runasuser
  17. Hi We have many different types of PC / Bios throughout our estate. I have been tasked in writing a script that will deploy the correct BIOS update to the relevant PC. I thought of running something along the lines of following. If Chassis Product Name = "HP ........" then deploy this EXE. My issue is I have no idea how to locate the correct String for the if Statement Please, can somebody advise how I would do this? Robin
  18. I'm using Dobermans script XML, I've edited the default config, pushing it out to a few for testing, it works until Windows 10 decides to 'scale' or when you've got multiple monitors with multiple resolutions, etc... needless to say, it's got some bugginess since Windows 10 has been introduced into the equation... My question is this: Has anyone figured out a workaround to get BGInfo working happily with Windows 10? if you wouldn't care, can you share some advice on how to overcome the display issue with scaling and tiling? Even with scaling set to 100%, both with slider and with manual entry, still getting the tiling effect with unsightly displays of BGInfo in multiple places across the screen. Any and all help is appreciated.
  19. Automate installations provide a number of custom MySQL functions. These helped fill particular needs within the program, but they can help you too!. Suppose you have two version numbers, like VER1=10.3 and VER2=10.2. Trying to compare them directly is a StringComparison and returns only 1 or 0 (True or False). A proper version comparison will tell you if VER1 is LESS than, EQUAL to, or GREATER than VER2. The custom function LT_CompareVersions('VER1','VER2') will do just this. Here is how the function works in practice. If VER1 is greater, the result should be "1", if it is less it should be "-1", and "0" if equal. Evaluating, StringCompare, VersionCompare, ShouldBe '11.34>11', '1', '1', '1' '11.34>11.4', '0', '1', '1' '1.10.0>11.0.0', '0', '-1', '-1' '2.10.0>11.0.0', '1', '-1', '-1' '11.34.0.0>11.4.99.99', '0', '1', '1' You can see that a simple version compare will work with VER1>VER2, but when they get more complex you would get the wrong result each time. Here is an example using the "IF SQL Check" script function. In my test, I want to know if the DiscoveredVersion is greater than my TargetVersion: IF [SQL SELECT (LT_CompareVersions('@DiscoveredVersion@','@TargetVersion@') > 0) AS VerResult] = 1 THEN Jump to :NoUpgradeNeeded
  20. Hello, I am looking to create a script which adds time to a ticket. I've tried to function 'Ticket Add Time' then entered the relevant data - this doesn't appear to do anything when run. I've also tried the option using the Time Recording tab which does nothing as well. Any ideas how to get this working?
×
×
  • Create New...