Jump to content
[[Template core/front/profile/profileHeader is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

Community Reputation

0 Neutral

My Information

  • Agent Count
    Less than 100

Converted

  • INTERESTS
    Squirrels, Knitting.
  • OCCUPATION
    Systems Administrator

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Good to know. Thanks for the heads up!!
  2. Labtech looks at two different registry keys/folders to see if a reboot is pending. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending If either of these keys/folders exist, then the machine is flagged as 1024. This is the "Reboot Needed" checkbox on the welcome tab of the agent. Labtech will check for these two registry keys each time the agent checks in. This script will manually create the registry entry for first registry key. The second can be edited because by default the Administrators group only has read permissions. Only trustedinstaller has full control and the ability to create this key/folder. Link to XML: TRG - Production - Set Reboot Pending.zip
  3. Create the Search Save search as CUSTOM – Reboot Prompt Midnight Create the Group Create a new folder under Groups called CUSTOM – Management This search should be a grayed master group Create a new folder under CUSTOM – Management called CUSTOM – Reboot Pending Auto Join Search: CUSTOM – Reboot Prompt Midnight Check Limit to Search Save the group then Run Now to populate the group Logic Breakdown of Script 1. Confirm that the machine the script is running against is windows and not a server. 2. Confirm that the script isn’t already running and in a sleeping state until midnight (See Reboot Already Scheduled) 3. Confirm that a reboot is needed (See Reboot Not Needed) 4. Define Script Variables 5. Confirm Autofix Reboot not Disabled (See AutoFix Reboot Disabled) 6. Confirm Console Logged on (See Console Logged On) 7. Prompt User to Reboot at Midnight or NOW a. IF Midnight, get the time until midnight and sleep b. ELSE Perform a few powershell write maintenance tasks and reboot the machine 8. Sleep for 5 minutes, then check the last contact time against the reboot time and confirm less than 5 minutes difference. (See Reboot Failed) 9. Add 15 minutes of billable ticket to the ticket and close it out. Reboot Already Scheduled 1. Exit Script Reboot Not Needed 1. Exit Script Reboot Failed 1. Create a ticket stating that reboot failed last checking time not less than 5 minutes. AutoFix Reboot Disabled 1. Create a ticket stating that reboot failed due to Autofix reboot being disabled. Notes about time category ID: https://docs.labtechsoftware.com/knowledgebase/article/7294 Notes about defaulting YES to midnight: I wouldn't be very happy if i got up to get a cookie, came back, and my machine had been rebooted. TRG - TEST - Reboot Prompt Midnight.zip
  4. With the help of the super awesome MartynKeiger (http://www.labtechgeek.com/forum/memberlist.php?mode=viewprofile&u=55) the correct SQL Query is: SELECT COUNT(scriptid) FROM runningscripts JOIN lt_scripts USING (scriptid) WHERE lt_scripts.scriptguid='5da78133-ac9d-11e4-9c38-000c29235462' AND computerid=%computerid% > 1 :ScriptAlreadyRunning
  5. Part of the script I'm working on gives the user the option to delay a reboot until midnight. If a user says to delay a reboot at 8AM, and then the script runs again 6 hours later, I want to just exit the script. I went digging through an out of the box labtech script and found this line: SELECT COUNT(scriptid) FROM scheduledscripts JOIN lt_scripts USING (scriptid) WHERE lt_scripts.scriptguid='5da78133-ac9d-11e4-9c38-000c29235462' AND computerid=%computerid% > 1 :RebootAlreadyScheduled I set a variable to that SQL query so I can see what the count is. When I ran the script, the count was at 25. Each time i run the script, it adds one more onto the count. The script doesn't sleep and it immediately exits, so it's not technically "scheduled" (nothing in the dashboard either for scheduled scripts) Anyone have any thoughts on how to edit the SQL string to make it spit out how many times this script is ACTIVE? Anyone know of an alternative way to get this info?
  6. Install .NET Framework 4.5 Prerequist for Powershell Done: http://www.labtechgeek.com/forum/viewtopic.php?f=3&t=1352&p=8493 Next step is install powershell 4: http://social.technet.microsoft.com/wiki/contents/articles/21016.how-to-install-windows-powershell-4-0.aspx AND https://4sysops.com/archives/deploying-powershell-4-with-group-policy/
  7. Note: Additional information can be found at https://4sysops.com/archives/deploying-powershell-4-with-group-policy/ Download the Installation Packages Navigate to http://go.microsoft.com/fwlink/?LinkId=225702 and download the .NET Framework 4.5 installer (dotnetfx45_full_x86_x64.exe) Place package in the LT servers’ transfer directory (Example: L:\Transfer\Software\.NET Framework 4.5) General Script Steps 1. Check registry key 2. check if installer exists 3. make directory for installer 4. download the installer from LT server 5. check if installer exists 6. Run the installer quietly 7. Confirm registry key XML: TRG - Production - Install .NET Framework 4.5.zip
  8. Additional thoughts... $_.size should be -gt 32GB, not 20. Agent will need powershell 4 and storage module installed.
  9. Ok...quick dump for later. I had to use event id 15 and newest 2 because i don't have an event log for 55 (didn't create one) to work with. -newest should be changed to 1 and the eventid -eq 55 later. PS C:\WINDOWS\system32> get-eventlog -logname system -source disk -newest 2 | where-object {$_.eventid -eq 15} | select-object -last 1 -expandproperty replacementstrings \Device\Harddisk1\DR1 DR1 is a symbol link to the order in which PNP detects the device, therefor the harddisk value is the value that should be trimmed or regexed out. Once trimmed or matched or regexed, the value can go into @variable@ get-disk -number @variable@ | where-object -filterscript {$_.size -gt 64} more thinking required.
  10. Brandon, I'm not sure I'm entirely following, so let me see if I can get some clarification. 1. I tried to setup a monitor based on an EventID, but found that i was locked into the EventLog table and couldn't query the drives table. Do you know of another way, besides RAWSQL to do this? 2. Why can't a RAWSQL monitor trigger an alert template?
  11. Progress has been made, thanks to mister tim! Link to tim: http://www.labtechgeek.com/forum/memberlist.php?mode=viewprofile&u=3424 Here is the new configuration for the monitor. I then triggered an event using powershell PS C:\Windows\system32> write-eventlog -logname system -source disk -eventID 51 -message "This is a test" PS C:\Windows\system32> get-eventlog -logname system -source "disk" | where {$_.eventID -eq 51} Index Time EntryType Source InstanceID Message ----- ---- --------- ------ ---------- ------- 208194 Jan 28 10:32 Information disk 51 The description for Event ID '51' in Source 'di... After Inventory --> Resend Events on my agent, both the saved search and SQL query on the new custom monitor return values!
  12. Here's some clarification. This will build and query without an issue. As soon as I add a check for the drives, it fails to query because I'm locked into the eventblacklist table.
×
×
  • Create New...