Kaseya Community

Everybody post your scripts

  • I just purchased Kaseya and am trying different scripts and such but I would rather not re-invent the wheel . Lets start a script avalanche and see how many scripts people can post to help everybody.



    Sean Goss

    858-483-8770

    sean@crowncomputers.com


    Legacy Forum Name: Everybody post your scripts,
    Legacy Posted By Username: seangoss
  • chkdsk.zip
    I noticed no one posted a chkdsk script. Here is one that i have tested on windows xp. Its avb script

    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: slimshaney
  • We ran the script and then rebooted the machine, but chkdsk didn't run. Are we missing something?



    THanks!


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: rvines
  • We ended making changes to the vbs inorder to make it work. Increased wait time between steps.

    Script Name: Reboot and Checkdisk
    Script Description: Reboots Machine and then runs chkdsk /f on c:. Runs chkdsk.vbs

    IF True
    THEN
    Get Variable
    Parameter 1 : 10
    Parameter 2 :
    Parameter 3 : tempdir
    OS Type : 0
    Write File
    Parameter 1 : #tempdir#\chkdsk.vbs
    Parameter 2 : VSASharedFiles.chkdsk.vbs
    OS Type : 0
    Execute File
    Parameter 1 : %windir%\system32\wscript.exe
    Parameter 2 : #tempdir#\chkdsk.vbs
    Parameter 3 : 3
    OS Type : 0
    Reboot
    OS Type : 0
    ELSE
    '----------------------------------------------------------------------------------------------
    'This script launches chkdsk and sends keys to the UI in order to automate the chkdsk 'process.
    '----------------------------------------------------------------------------------------------
    set WshShell = CreateObject("WScript.Shell")

    'Launch chkdsk from the command line and wait for a second
    WshShell.Run "chkdsk /f"
    WScript.Sleep 200

    'Bring the application to the foreground
    WshShell.AppActivate "C:\WINDOW\system32\cmd.exe"
    WScript.Sleep 1000

    'Send a y key to confirm chkdsk on reboot
    WshShell.Sendkeys "Y"
    Wscript.Sleep 100

    'Send key to input the above choice
    WshShell.Sendkeys "{ENTER}"
    Wscript.Sleep 100




    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: rvines
  • chkdsk.zip
    Here is another approach using the registry. This script will modify the registry key which is changed when you run chkdsk /fmanually. The BootExecute key is normally "autocheck autochk *" and the attached script will change it to "autocheck autochk /r \??\C: autocheck autochk *" and back to normal.

    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: cberger
  • SetChkdsk.zip
    Still another approach was to utilize the Kaseya Packager and create a EXE package to change just one registry key. The included exe will only change the registry key BootExecute from "autocheck autochk *" to "autocheck autochk /r ??C: autocheck autochk *" so a chkdsk will run a reboot.

    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: cberger
  • You can not run chkdsk on a drive which currently has files open (i.e. the system drive). If you do you get the following message



    Chkdsk cannot run because the volume is in use by another

    process. Would you like to schedule this volume to be

    checked the next time the system restarts? (Y/N)



    The way around that is to pass an echo to the command

    echo Y|chkdsk.exe /f

    This will run chkdsk when the machine reboots



    The script can be as simple as this:



    Script Name: Check Disk on reboot

    Script Description:



    IF True

    THEN

    Execute Shell Command

    Parameter 1 : echo Y|chkdsk.exe /f

    Parameter 2 : 1

    OS Type : 0

    ELSE



    You can always add a reboot to the script to force it, or just wait for the user to reboot. I like to call a reboot script and prompt the user to say “ok”. Be creative.


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: Charles.spencer@kaseya.com
  • Now that you have the chkdsk script running, what do you do?

    You can create an alert for the application event log





    Ignore

    Source Filter Winlogon

    Category Filter *

    Event ID 1001

    User Filter * *

    Description Filter *Checking file system on*



    That will give you all the necessary information to make a positive difference.


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: Charles.spencer@kaseya.com
  • How do you read from the application log though. I can see how to read from the scripts log but can't seem to figure out how to read and search the app log.

    Thanks


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: toddbn
  • I answered my own question. You have to do it in the Alerts section, I missed that. would be nice to be able to read directly from it though through a script, I'll have to do some more research, but this should work for now.

    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: toddbn
  • If you run CHKDSK without any parameters, will it still identify bad sectors, or do you have to use /r parameter in order to identify a bad sector?

    Thanks!


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: billmccl
  • Here is a CHKDSK script that I wrote using VBScripting that automates a lot of what is involved with using this utility.

    In a nutshell, it will analyze all fixed drives on the remote system, attempt to fix them only if needed, and if a fix requires a restart, schedules for CHKDSK to run at system startup and reboots the computer. A detailed log of all actions is returned to the Kaseya server. All of this behavior (whether to fix/reboot or not) is customizable via constants at the top of the VBS file (chkdsks.vbs).

    http://www.securemycompany.com/forum/viewtopic.php?t=67

    Enjoy,

    -Ed


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: bellcpa
  • Admin Scripts.zip
    I wrote these simple scripts while deploying Kaseya to a client. There is a script to change the local administrator password, enable popup blocker for computers with SP2, one to remove the shutdown option forcing users to log off or restart. There is also one that disables printer auto search, preventing printers from automatically populating on computers with shared printers.


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: mhinnenkamp