System Admin Day to Day Activities

Server health is major activity of System Admin Day to Day Activities..
a. Disk space — Check disk space is major activity of sysadmin's life. Log file, data files and resources get created on the server so important keep track of server available and used space. We can use powershell do the task for us. Powershell monitor the spcae and create report for us in some cases you can set threshold limit for available server space like 25 percent less disk space remaining then shoot the email to sysadmin team.
b. Scheduled tasks — Have any scheduled tasks that are critical to your environment? Check these every day. here is the example scheduled using powershell and add all task or commands in the script file. This will easy your life.

  • Here

  • c. Event logs — Event logs are one of the best means of identifying and resolving issues within your system. This is needed for admin as well as developers to find the defect or monitor server health. Have an application that crashed unexpectedly last night? Application log, Security log or System log.


    d. Service log — to track changes made to your systems like some installation happened on the server encounter an event log message that requires attention or make hardware changes to a server it update its service log. Service log is the best way to prevent future issues or refer back to previous ones is to maintain a service log.
    We will see, how powershell helps us (SYSAdmin's) in simple ways. Using PowerShell you can easily do the massive system/application configuration changes.

  • Create scheduled PowerShell script that launches task
  • Creating-users-with-windows-powershell
  • SQL Powershell Script to fetch or pull data
  • Check Disk space on clusters
  • IIS Admin using powershell
  • Install shield object processing with PS
  • logs archiving using powershell
  • SQL Server Automation With Powershell
  • SQL Server TEMP DB Issues


  • We will be adding powershell script and description soon.
    Top 10 cool things we can do with Windows

    Below is important script for system to monitor any file size. e.g. any log file size
    Once desired size reached it will trigger email to admin.
    You can create windows scheduled task/job and asssign below script(create file alert.ps1)

    Example

    #* ======================
    #* Alert Me Script
    #* ======================
    #* Create Email Function
    #* ======================
    
    
    function sendEmail {
    [System.Reflection.Assembly]::LoadWithPartialName("System.Net")
    [System.Reflection.Assembly]::LoadWithPartialName("System.Net.Mail")
    [System.Reflection.Assembly]::LoadWithPartialName("System.Net.Mail.MailMessage")
    #* Create new .NET object and assign to variable
    $mail = New-Object System.Net.Mail.MailMessage
    
    #* Sender Address
    $mail.From =  New-Object System.Net.Mail.MailAddress("[email protected]");
    
    
    #* Recipient Address
    $mail.To.Add("[email protected]");
    
    #* Message Subject
    $mail.Subject = "Place Subject of email here";
    
    #* Message Body
    $mail.Body = "Place body content here";
    
    #* Connect to your mail server
    $smtp = New-Object System.Net.Mail.SmtpClient("smtp.gmail.com");
    $smtp.Port = "587";
    
    
    #* Uncomment line below if authentication is required
    $smtp.Credentials = New-Object System.Net.NetworkCredential("[email protected]", "password");
    
    #* Send Email
    $smtp.EnableSsl = "true";
    $smtp.Send($mail);
    }
    
    #* =====================
    #* Script Body
    #* =====================
    
    #* Connect to file. You can connect to a local file or a remote file via UNC.
    #* In this example I connect to a remote share
    $File = Get-ChildItem "E:\Xyz\File.log"
    
    #* Check File size and take action based on condition.
    $filesizelimit = 100
    #KB
    If ($File.Length -gt $filesizelimit * 1000) 
    #If condition is TRUE call sendEmail function
    {
    sendEmail
    }
    
    #* If condition is FALSE script does nothing
    
    

    Copy and Try it