Showing posts with label automation. Show all posts
Showing posts with label automation. Show all posts

Sunday, 16 October 2016

Automated Windows Server monitoring, maintance on daily alert email using powershell, check low space

Hey, Hello Dear reader, we have another blog, that is useful for Windows Admin, Server Admin or SharePoint Admins also,

We have number of servers for productions, UAT and Integration so going to each server (DB, WFE, Application and DMZ servers) etc and checking for frees pace or Server should have all running services running etc that's really hectic and time consuming, people already started making thier task automated to monitor 10 of or even 100s of server..

In short, yeah we can MAKE WORK Short as blog link says, we can do it in simpler way.

we need to create a task scheduler and run PowerShell script that can check for free space, running services and process etc... and send an email for all these details.

Here I am sharing sample script to check timely Server space daily and sends an alert email using powershell.





Any time above sample can be downloaded on clicking Download here link.

--
Comments & Feedback are welcome, and yeah don't forget to share this make short link.



Thursday, 30 July 2015

Update Modified by and Created by in SharePoint list

Some of you have face the situation to update list with large number of items or some time we have to change, so that lead to change Modified By to your name; Modified or created by names of all items, yeah we are aware about System.Update() method but if data has populated and no code action will take place and requirement says to update because we don't wants to confuse client/Business users and his customers so in very rare and after approval we execute it to update modified and created by names.

We can use below script to update thousands of list items in single shot. but take care once changes are done by PowerShell can not be roll back. 

so to update SharePoint list items simply can save below PowerShell script in a .PS1 file and run it with Elevated privileges in SharePoint server where you has permission to modify items. 

PowerShell:


<# Created by: MakrShortWork
   Purpose:   To update Modified and created by Names.
   Created Date: June, 2011
#>

  $web = Get-SPWeb "http://YourWebUrl"
  $spList =  $web.Lists["ListName"]  
  $ListItemID = 23;
  $UserName =$ web.EnsureUser("domain\useridLoginId");  
     
  $caml = '<Where><Eq><FieldRef Name="ID" /><Value Type="Text">{0}</Value></Eq> </Where>' -f $ListItemID
  $query = new-object Microsoft.SharePoint.SPQuery
  $query.Query=$caml
  $oItem = $spList.GetItems($query)[0]

# in List Created by -Author and Modifed by -Editor
     $oItem["Author"] = $UserName           
     $oItem["Editor"] = $UserName  

     # You can add other fields here any field value data time etc....
     $oItem.Update()
    # You can use SystemUpdate(true/false);

Please run script on SharePoint server with Admin privileges,
Share or refer the link, that may help some one

-