Wednesday, June 17, 2015

Introduction to Enterprise Architecture Framework And TOGAF


                                    I am very happy to say that, today i have given an interesting session on Enterprise Architecture Framework and overview of TOGAF 9.1.

                                    Initially i have covered the basics of Enterprise Architecture Framework (What is Enterprise,Architecture, Enterprise Architecture etc..) and later i have focused on how TOGAF help us to define Enterprise Architecture. Most of the time I have taken real time scenarios rather than explaining in theoretical.The overall session went very well with bunch of questions and discussion.  Down the line i am planning to take few more session on TOGAF. Here is the presentations .



Thursday, June 4, 2015

Way to get back our windows start button in Windows Server 20012 machines

Hey Guys,

Are you frustrated with windows tiles and windows start menu in  Windows Server2012 machines. Here is the software to get back our loved classic windows start button .

Here is the link to download classic shell setup
 http://www.mediafire.com/download/iwcm97wqp47gjjk/ClassicShellSetup_4_2_1.exe




Wednesday, May 27, 2015

Power Shell script to create SharePoint page with page viewer web part-SharePoint 2013

<pre class="brush:ps">

[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges(
    {
# Add the PowerShell Snapin
 $snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
 if ($snapin -eq $null)
 {
     Add-PSSnapin "Microsoft.SharePoint.Powershell"
 }
  function CreateSharePointPage($SiteUrl,$PageName,$PageTitle)
  {

  write-host "Get the PageLayout" -foregroundcolor Green
  $PageLayoutRelUrl = "/_catalogs/masterpage/BlankWebPartPage.aspx"
 
 write-host "Initialize the Site Object" -foregroundcolor Green
 # Initialize the Site Object
 write-host $SiteUrl -foregroundcolor Green
 $Site = Get-SPWeb -Identity $SiteUrl
 write-host "Get the Publishing Site based on the SPSite" -foregroundcolor Green
 # Get the Publishing Site based on the SPSite
 write-host "Get the SPWeb Object" -foregroundcolor Green
 # Get the SPWeb Object
 $Web = Get-SPWeb($SiteUrl)
 
 write-host "Initialize the Publishing Web based on the SPWeb" -foregroundcolor Green
 # Initialize the PublishingWeb based on the SPWeb
 $PubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($Web)
  
 write-host "Get the PageLayouts Installed on the Publishing Site" -foregroundcolor Green
 # Get the PageLayouts Installed on the Publishing Site
 $pl = $pubWeb.GetAvailablePageLayouts() | Where { $_.Name -eq "BAYADA_BlankWebPartPage.aspx" }
 #$Layouts = $PubSite.GetPageLayouts($True)
 
 # Get our PageLayout
 #$PageLayout = $Layouts[$PageLayoutRelUrl]
  
 write-host "Create a new publishing page." -foregroundcolor Green
 $Page= $null;

 # Create a new publishing page.
 try
 {
 write-host "Getting Existing file "
 $ExistingPageUrl=$SiteUrl+"Pages/"+$PageName;
 $PublishingPage = $Web.GetFile($ExistingPageUrl);
 write-host $ExistingPageUrl
 write-host $PublishingPage
  write-host "Doing Check out"
 $PublishingPage.CheckOut()
  write-host "Deleting file"
 $PublishingPage.Delete()

 }
 Catch{}

 try
 {

 $Page = $PubWeb.AddPublishingPage($PageName, $pl)

  }
   Catch
   {
   write-host $_.Exception.Message -ForegroundColor Red
   #$ErrorMessage = $_.Exception.Message
    # Get only our Page

   }
 write-host "Assign the Title for the Page." -foregroundcolor Green
 # Assign the Title for the Page
 $Page.Title = $PageTitle
 
 write-host "Update the page" -foregroundcolor Green
 # Update the Page
 $Page.Update();
 
 write-host "Check in the Page with Comments" -foregroundcolor Green
 # Check in the Page with Comments
 $Page.CheckIn("Automatic Check in")
 
 write-host "Publish the Page With Comments" -foregroundcolor Green
 # Publish the Page With Comments

 $Page.ListItem.File.Publish("Automatic Publish Comment")

 }

 function AddPageViewerWebPart($SiteURL, $pageUrl, $Zone, $title,$contentLink)
  {
  # Add the PowerShell Snapin
 $snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
 if ($snapin -eq $null)
 {
     Add-PSSnapin "Microsoft.SharePoint.Powershell"
 }
  Start-SPAssignment -Global             
   # $spWeb = Get-SPWeb -Identity "http://localhost:32712/"
 write-host "Creating SPWeb object" -foregroundcolor Green
  $web = Get-SPWeb -Identity $SiteURL
   write-host "Getting current webpage  object" -foregroundcolor Green
  $page =  $web.GetFile($pageUrl)
     write-host "Performing checkout for current webpage" -foregroundcolor Green
  $page.CheckOut()
write-host "Getting webpartmanager" -foregroundcolor Green
$webpartmanager=$web.GetLimitedWebPartManager($pageUrl, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
write-host "Creating Page Viewer WebPart" -foregroundcolor Green
$webpart = new-object Microsoft.SharePoint.WebPartPages.PageViewerWebPart;
$webpart.Title = $title
    $webpart.ChromeType=[System.Web.UI.WebControls.WebParts.PartChromeType]::TitleOnly;
   $webpart.Height = "9in";
write-host "Setting ContentLink" -foregroundcolor Green
$webpart.ContentLink = $contentLink;
write-host "Adding Page Viewer webpart in Center" -foregroundcolor Green

$webpartmanager.AddWebPart($webpart,$Zone,2);
write-host "Performing check in for current webpage"
-foregroundcolor Green
$page.CheckIn("Automatic CheckIn")

  write-host "Publishing current page" -foregroundcolor Green
   write-host $page
   $page.Publish("Automatic Publish Comment");
write-host "Done" -foregroundcolor Green
$web.Close()
#$spWeb.Close()

}

#Example to call these methods to create sharepoint page

#Site url where we need to create/Edit page
$SiteUrl= "http://sphome.devtest.bayada.com/payroll/" ;

#Page Name
$PageName="UpdateOriginalHireDate.aspx";

#Page Title
$PageTitle="Update Original Hire Date";

#Page full Url to Add the webpart
       $PageUrl="http://localhost:3434/teamsite/test.aspx";
#Specify the Zone where you want to place the WebPart Ex: Header,Center,Footer
$Zone="Header";
#Content Title
$ContentTitle="  ";
#URL link to set in the PageViewerWebPart
$ContentUrl="/_apps/ors/GetUsers";
#Specify the Header where the left Navigation node tobe added
$Header="Finance";
     CreateSharePointPage $SiteUrl  $PageName $PageTitle;
     AddPageViewerWebPart $SiteUrl  $PageUrl $Zone $ContentTitle $ContentUrl ;

</pre>