13. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 7/17/2018 6:16:26 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

13.1 Files compared

# Location File Last Modified
1 RAMS-2.3.0.zip\RAMS-2.3.0\ps\module RAMS_Module_Util.psm1 Tue May 15 22:15:02 2018 UTC
2 RAMS-2.3.0.zip\RAMS-2.3.0\ps\module RAMS_Module_Util.psm1 Tue Jul 17 20:35:48 2018 UTC

13.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 9 2894
Changed 8 36
Inserted 0 0
Removed 0 0

13.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

13.4 Active regular expressions

No regular expressions were active.

13.5 Comparison detail

  1   try {
  2   Add-PSSnap in Microso ft.SharePo int.PowerS hell -Erro rAction Si lentlyCont inue
  3   }
  4   catch {
  5    Write-Hos t "PSSnapi n Microsof t.SharePoi nt.PowerSh ell alread y loaded"  -Foregroun dColor Yel low
  6   }
  7  
  8   Set-Strict Mode -Vers ion Latest
  9  
  10   if($env:CO MPUTERNAME  -match "V APH" ) {
  11       Add-Ty pe -Path . \RAMSUtil. dll
  12   }
  13   else {
  14       Add-Ty pe -Path . .\UtilityS cripts\RAM SUtil.dll
  15   }
  16  
  17  
  18   function R emove-Cale ndarColumn s ([String []]$colLis t, $calTit le) { 
  19       foreac h ($col in  $colList)  {
  20           fo reach ($su bweb in (G et-SiteWeb ).Webs) {
  21                 $calLis t = $subwe b.Lists.Tr yGetList($ calTitle)          
  22                 #remove  column
  23                 if($cal List.Field s.TryGetFi eldByStati cName($col ) -ne $Nul l) {
  24                     $ca lList.Fiel ds.Delete( $col)
  25                     Wri te-Host $c ol has bee n deleted  from $subw eb :- $cal List  -For egroundCol or Yellow
  26                     $ca lList.Upda te()
  27                 }
  28           }
  29       }
  30   }
  31  
  32   function R unSQL-Retu rnInt ($sq lQuery,$db Server) {
  33   <#
  34   .DESCRIPTI ON
  35   The functi on use Win dows Authe ntication  for access  to the SQ L database , it takes  two argum ents, both  required,  please re fer the ex ample to g et more de tails.
  36  
  37   .EXAMPLE
  38   $cleanUpDa te = "'05/ 30/2017'"
  39   $dbServer  = " .DNS             "
  40   $query = " exec DataC lenup $cle anUpDate"
  41   $result =  RunSQL-Ret urnInt -sq lQuery $qu ery -dbSer ver $dbSer ver
  42   Write-Host  "Number o f rows del eted: $res ult" -Fore groundColo r Cyan
  43   #>
  44       $RAMSS QL = New-O bject Gov. VA.RAMS.RA MSUtil.Uti l    
  45       $RAMSS QL.SQLConn ectionStri ng = "Serv er=$dbServ er;Databas e=RAMS;Tru sted_Conne ction=Yes; "
  46       $resul t = $RAMSS QL.RunSQL( $sqlQuery)
  47       #close  connectio n
  48       if($RA MSSQL.SQLC onnection. State -ne  "Closed")  {
  49           $R AMSSQL.Clo seSQLConne ction()
  50       }
  51       return  $result
  52   }
  53  
  54   function R unSQL-Retu rnDR ($sql Query,$dbS erver) {
  55   <#
  56   .DESCRIPTI ON
  57   The functi on use Win dows Authe ntication  for access  to the SQ L database , it takes  two argum ents, both  required,  please re fer the ex ample to g et more de tails.
  58  
  59   .EXAMPLE
  60    $result =  RunSQL-Re turnDR -sq lQuery "se lect * fro m Studies"  -dbServer   DN S    
  61   #>
  62       $RAMSS QL = New-O bject Gov. VA.RAMS.RA MSUtil.Uti l    
  63       $RAMSS QL.SQLConn ectionStri ng = "Serv er=$dbServ er;Databas e=RAMS;Tru sted_Conne ction=Yes; "
  64       $dR =  $RAMSSQL.R unSQLRestu rnDS($sqlQ uery)         
  65       return  $dR
  66   }
  67  
  68  
  69  
  70   #region Fu nction Get -RAMSShare PointInsta llInfo
  71   Function G et-RAMSSha rePointIns tallInfo
  72   {
  73   <# 
  74   .EXAMPLE
  75   Get-RAMSSh arePointIn stallInfo
  76  
  77   .EXAMPLE
  78   Get-RAMSSh arePointIn stallInfo  | Format-T able -Auto Size
  79  
  80   .EXAMPLE
  81   Get-RAMSSh arePointIn stallInfo  -Verbose
  82  
  83   # Requires  PowerShel l Version  2.0 or Ver sion 3.0
  84   # Requires  to be exe cuted as a n Administ rator
  85   #>
  86   [CmdletBin ding()]
  87   Param()
  88  
  89       Begin  {
  90           Wr ite-Verbos e "Enterin g Begin Bl ock"
  91  
  92           if  (-NOT ([S ecurity.Pr incipal.Wi ndowsPrinc ipal][Secu rity.Princ ipal.Windo wsIdentity ]::GetCurr ent()).IsI nRole([Sec urity.Prin cipal.Wind owsBuiltIn Role] "Adm inistrator "))
  93           {
  94                Write-Wa rning "You  do not ha ve Adminis trator rig hts to run  this scri pt!`nPleas e re-run t his script  as an Adm inistrator !"
  95                Exit
  96           }
  97           el se {
  98                Write-Ve rbose "You  are an Ad ministrato r. Continu e to Proce ss Block."
  99           }
  100  
  101  
  102           tr y {
  103                $isSPPow erShellLoa ded = $nul l
  104                $SPSnapi n = "Micro soft.Share Point.Powe rShell"
  105                if (Get- PSSnapin $ SPSnapin - ErrorActio n Silently Continue)  {
  106                    $isS PPowerShel lLoaded =  $true
  107                    Writ e-Verbose  "Microsoft .SharePoin t.PowerShe ll Snappin  already r egistered  and loaded "
  108                }
  109                elseif ( Get-PSSnap in $SPSnap in -Regist ered -Erro rAction Si lentlyCont inue) {
  110                    Add- PSSnapin $ SPSnapin
  111                    $isS PPowerShel lLoaded =  $true 
  112                    Writ e-Verbose  "Microsoft .SharePoin t.PowerShe ll Snappin  is regist ered and h as been lo aded for s cript oper ation"
  113                }
  114                else {
  115                             $isSPo werShellLo aded = $fa lse
  116                    Writ e-Warning  "Microsoft .SharePoin t.PowerShe ll Snappin  not found ."
  117                             Write- Warning "W ill not be  able to r eport Shar ePoint Bui ld Version "
  118                }
  119  
  120           }
  121           ca tch {
  122                    $isS PPowerShel lLoaded =  $false
  123                Write-Er ror "There  was an is sue loadin g the Micr osoft.Shar ePoint.Pow erShell Sn appin. Scr ipt execut ion will c ontinue"
  124                    Writ e-Error $_
  125                    Writ e-Warning  "Will not  be able to  report Sh arePoint B uild Versi on"             
  126           }
  127  
  128           Wr ite-Verbos e "Leaving  Begin Blo ck"
  129       }
  130  
  131       Proces s {
  132           Wr ite-Verbos e "Enterin g Process  Block"
  133           
  134           Wr ite-Verbos e "Define  SharePoint  2010 Prod ucts Regis try Path v ariable"
  135           $R egPath2010  = "HKLM:\ SOFTWARE\M icrosoft\S hared Tool s\Web Serv er Extensi ons\14.0\W SS\Install edProducts \"
  136  
  137           Wr ite-Verbos e "Define  SharePoint  2010 Prod ucts hash  table"
  138           Wr ite-Verbos e "SharePo int 2010 S KU ID's fo und at htt p://msdn.m icrosoft.c om/en-us/l ibrary/ff7 21969(v=of fice.14).a spx"
  139           $S P2010Produ cts = @{
  140                                                   "BEED1 F75-C398-4 447-AEF1-E 66E1F0DF91 E" = "Shar ePoint Fou ndation 20 10"
  141                                                   "1328E 89E-7EC8-4 F7E-809E-7 E945796E51 1" = "Sear ch Server  Express 20 10"
  142                                                   "B2C0B 444-3914-4 ACB-A0B8-7 CF50A8F7AA 0" = "Shar ePoint Ser ver 2010 S tandard Tr ial"
  143                                                   "3FDFB CC8-B3E4-4 482-91FA-1 22C6432805 C" = "Shar ePoint Ser ver 2010 S tandard"
  144                                                   "88BED 06D-8C6B-4 E62-AB01-5 46D6005FE9 7" = "Shar ePoint Ser ver 2010 E nterprise  Trial"
  145                                                   "D5595 F62-449B-4 061-B0B2-0 CBAD410BB5 1" = "Shar ePoint Ser ver 2010 E nterprise"
  146                                                   "BC4C1 C97-9013-4 033-A0DD-9 DC9E6D6C88 7" = "Sear ch Server  2010 Trial "
  147                                                   "08460 AA2-A176-4 42C-BDCA-2 6928704D80 B" = "Sear ch Server  2010"        
  148                                                   "84902 853-59F6-4 B20-BC7C-D E4F419FEFA D" = "Proj ect Server  2010 Tria l"
  149                                                   "ED216 38F-97FF-4 A65-AD9B-6 889B93065E 2" = "Proj ect Server  2010"
  150                                                   "926E4 E17-087B-4 7D1-8BD7-9 1A394BC619 6" = "Offi ce Web Com panions 20 10"
  151                                               }
  152  
  153  
  154           Wr ite-Verbos e "Define  SharePoint  2013 Prod ucts Regis try Path v ariable"
  155           $R egPath2013  = "HKLM:\ SOFTWARE\M icrosoft\S hared Tool s\Web Serv er Extensi ons\15.0\W SS\Install edProducts \"
  156  
  157           Wr ite-Verbos e "Define  SharePoint  2013 Prod ucts hash  table"
  158           Wr ite-Verbos e "SharePo int 2013 S KU ID's fo und at htt p://msdn.m icrosoft.c om/en-us/l ibrary/jj6 59075.aspx "
  159           $S P2013Produ cts =  @{
  160                                                   "35466 B1A-B17B-4 DFB-A703-F 74E2A1F5F5 E" = "Proj ect Server  2013"
  161                                                   "BC7BA F08-4D97-4 62C-8411-3 41052402E7 1" = "Proj ect Server  2013 Prev iew"
  162                                                   "C5D85 5EE-F32B-4 A1C-97A8-F 0A28CE02F9 C" = "Shar ePoint Ser ver 2013"
  163                                                   "CBF97 833-C73A-4 BAF-9ED3-D 47B3CFF51B E" = "Shar ePoint Ser ver 2013 P review"
  164                                                   "B7D84 C2B-0754-4 9E4-B7BE-7 EE321DCE0A 9" = "Shar ePoint Ser ver 2013 E nterprise"
  165                                                   "298A5 86A-E3C1-4 2F0-AFE0-4 BCFDC2E7CD 0" = "Shar ePoint Ser ver 2013 E nterprise  Preview"
  166                                                   "D6B57 A0D-AE69-4 A3E-B031-1 F993EE52ED C" = "Micr osoft Offi ce Web App s Server 2 013"
  167                                                   "9FF54 EBC-8C12-4 7D7-854F-3 865D4BE811 8" = "Shar ePoint Fou ndation 20 13"       
  168                                               }
  169  
  170  
  171           Wr ite-Verbos e "Define  function v ariables t o store da ta based o n current  environmen t"
  172           $R egPath = $ null
  173           $S PProducts  = $null
  174           $S harePointV ersion = $ null
  175           $C anProcess  = $false
  176  
  177           Wr ite-Verbos e "Test Re gistry Pat hs to dete rmine if c urrent env ironment h as SharePo int 2010 o r 2013 ins talled"
  178           $i s2010 = Te st-Path $R egPath2010
  179           $i s2013 = Te st-Path $R egPath2013
  180  
  181           Wr ite-Verbos e "Populat e function  variables  with Shar ePoint ver sion speci fic data,  if the env ironment c ontains Sh arePoint 2 010/2013"
  182           if ($is2010)  {
  183                Write-Ve rbose "Sha rePoint 20 10 is inst alled"
  184                $RegPath  = $RegPat h2010
  185                $SPProdu cts = $SP2 010Product s
  186                $SPVersi on = 2010
  187                $CanProc ess = $tru e
  188  
  189           }
  190           el seif($is20 13) {
  191                Write-Ve rbose "Sha rePoint 20 13 is inst alled"
  192                $RegPath  = $RegPat h2013
  193                $SPProdu cts = $SP2 013Product s
  194                $SPVersi on = 2013
  195                $CanProc ess = $tru e
  196  
  197           }
  198           el se {
  199                Write-Wa rning "Sha rePoint 20 10 or 2013  is not in stalled wi thin curre nt environ ment"   
  200                Write-Wa rning "Has h table in tended to  store Shar ePoint Pro duct infor mation wil l be empty "    
  201           }
  202  
  203  
  204           Wr ite-Verbos e "Define  hash table  to store  installed  SharePoint  Product i nformation "
  205           $I nstalledPr oducts = @ {}
  206  
  207           Wr ite-Verbos e "Verify  that curre nt environ ment is ho sting Shar ePoint 201 0 or 2013"
  208           if ($CanProce ss) {
  209  
  210                    Writ e-Verbose  "Determine  whether t he Microso ft.SharePo int.PowerS hell Snapp in is load ed"
  211                    if($ isSPPowerS hellLoaded ) {
  212                             try {
  213                                      Write-Ve rbose "Get  SharePoin t Build Ve rsion"
  214                                      $SPBuild Version =  (Get-SPFar m).BuildVe rsion.ToSt ring()
  215  
  216                                      Write-Ve rbose "Add ing the Sh arePoint B uild Versi on to the  InstalledP roducts ha sh table"
  217                                      $Install edProducts .Add("Shar ePoint $SP Version Bu ild Versio n",$SPBuil dVersion)
  218                             }
  219                             catch  {
  220                                      Write-Er ror "Unabl e to get t he SharePo int Build  Version."
  221                                      Write-Er ror $_
  222                             }
  223                    }
  224  
  225  
  226                Write-Ve rbose "Sha rePoint $S PVersion i s installe d within t he current  environme nt"
  227                Write-Ve rbose "Pop ulate Inst alledProdu cts hash t able with  SharePoint  Products  installed  on current  environme nt"
  228                Get-Item  $RegPath 
  229                    Sele ct-Object  -ExpandPro perty prop erty | 
  230                    ForE ach-Object  {(Get-Ite mProperty  -Path $Reg Path -Name  $_).$_}  
  231                         ForEach-Ob ject {$Ins talledProd ucts.Add($ SPProducts .Get_Item( $_),$_)}
  232           }
  233  
  234           Wr ite-Verbos e "Output  the Instal ledProduct s hash tab le to pipe line."
  235           Wr ite-Output  $Installe dProducts 
  236           
  237           Wr ite-Verbos e "Leaving  Process B lock"        
  238       }
  239  
  240   }
  241  
  242   #endregion
  243  
  244   function G et-SiteURL  {
  245       $site  = Get-SPSi te -Limit  All | Sele ct-String  IRBApplica tions
  246       $x = $ site.ToStr ing();
  247       $url =  $x.Substr ing($x.Ind exOf("=")+ 1)
  248       $w = G et-SPWeb $ url
  249       return  $url
  250   }
  251  
  252   function G et-SiteWeb  {
  253       $url =  Get-SiteU RL
  254       $xWeb  = Get-Spwe b $url
  255       return  $xWeb
  256   }
  257  
  258  
  259   Function D eploy-Feat ure {
  260  
  261   Param(           [Par ameter(Man datory=$Tr ue)]
  262                    [str ing]$SiteC ollection,
  263  
  264                    [Par ameter(Man datory=$Tr ue)]
  265                    [str ing]$site,
  266  
  267                    [Par ameter(Man datory=$Tr ue)]
  268                    [str ing]$Featu reName,
  269  
  270                    [Par ameter(Man datory=$Tr ue)]
  271                    [str ing]$OldFe atureId,
  272  
  273                    [Par ameter(Man datory=$Tr ue)]
  274                    [str ing]$Featu reId,
  275  
  276                    [Par ameter(Man datory=$Tr ue)]
  277                    [str ing]$file,
  278  
  279                    [Par ameter(Man datory=$Tr ue)]
  280                    [boo l] $bolUni nstall,
  281  
  282                    [Par ameter(Man datory=$Fa lse)]
  283                    [boo l] $bolEna bleFeature Only   
  284                    )
  285       
  286  
  287           Ad d-PSSnapin  Microsoft .SharePoin t.PowerShe ll
  288  
  289       # GET  THE SITE C OLLECTION
  290       $SiteC ollectionw eb = Get-S PWeb $Site Collection
  291  
  292       # GET  THE SITE
  293       $web =  Get-SPWeb  $site
  294  
  295       # CLEA N and old  one first
  296       if($bo lEnableFea tureOnly - eq $False)  {
  297           if ($bolUnins tall)
  298           {
  299                Write-Ho st "  Unin stall old  ones"
  300                
  301                Write-Ho st "    Di sabling fe ature Iden tity $OldF eatureId U RL $web.Ur l"
  302                Disable- SPFeature  -Identity  $OldFeatur eId -Url $ SiteCollec tionweb.Ur l -Force - ErrorActio n Silently Continue  
  303                
  304                Write-Ho st "    Un installing  feature I dentity $F eatureName  Site $Sit eCollectio nweb.Url"
  305                Uninstal l-SPUserSo lution -Id entity $Fe atureName  -Site $Sit eCollectio nweb.Site 
  306                
  307                Write-Ho st "    Re moving fea ture Ident ity $Featu reName Sit e $SiteCol lectionweb .Url"
  308                Remove-S PUserSolut ion -Ident ity $Featu reName -Si te $SiteCo llectionwe b.Site 
  309                $web.Upd ate()     
  310                
  311                #remove  from workf low manage r as well
  312                Remove-W orkFlow -w fMatchName  ($Feature Name.Repla ce(".wsp", "")) -wfWe b $web
  313           }
  314           #  ADD/UPLOAD  TO THE SO LUTIONS
  315           Wr ite-Host "   Adding n ew ones"
  316           Wr ite-Host "     Adding  feature f ile $file  Site $Site Collection web.Url"
  317           Ad d-SPUSerSo lution -Li teralPath  $file -Sit e $SiteCol lectionweb .Url -Verb ose 
  318           $w eb.Update( )
  319           #  ACTIVATE T HE SOLUTIO N
  320           Wr ite-Host "   Activati ng new one s"
  321           Wr ite-Host "     Instal l feature  Identity $ FeatureNam e Site $Si teCollecti onweb.Url"
  322           In stall-SPUs erSolution  -Identity  $FeatureN ame -Site  $SiteColle ctionweb.U rl 
  323           $w eb.Update( )
  324       }
  325       # ENAB LE THE FEA TURE FOR T HE GIVEN S ITE
  326       # feat ure id goe s into -Id entity
  327       Write- Host "  En abling new  ones"
  328       Write- Host "     Enabling f eature Ide ntity $Fea tureName U rl $web.Ur l"
  329       Enable -SPFeature  -Identity  $FeatureI d -Url $we b.Url -Ver bose -Forc e
  330       $web.U pdate()
  331   }
  332  
  333   function A dd-SiteCol umnToCTByT itle ([Mic rosoft.Sha rePoint.SP SecurableO bject]$web , [String] $ctName,[S tring]$sFi eldTitle)  {
  334       $ct =  $web.Conte ntTypes[$c tName];
  335       $field =$web.Fiel ds.GetFiel d($sFieldT itle)
  336       $sFiel dStaticNam e = $field .StaticNam e
  337  
  338       if(!$c t.Fields.C ontainsFie ldWithStat icName($sF ieldStatic Name)){
  339                $link =  new-object  Microsoft .SharePoin t.SPFieldL ink $field
  340           #c heck if co mments fie lds exist  or not.
  341           if (($ct.Fiel dLinks | W here-Objec t {$_.Name  -eq $fiel d.Internal Name}) -EQ  $null) {
  342                    $ct. FieldLinks .Add($link )
  343                    $ct. Update($tr ue)
  344                Write-Ho st $sField Title Fiel d has been  added to  $ct -Foreg roundColor  Green
  345           }
  346           el se {
  347                Write-Ho st $sField Title Fiel d already  exist -For egroundCol or Yellow
  348           }
  349       }
  350   }
  351  
  352  
  353   function A dd-SiteCol umnToCT ([ Microsoft. SharePoint .SPSecurab leObject]$ web, [Stri ng]$ctName ,[String]$ sFieldInte rnalName,  [String]$s FieldStati cName) {
  354       $ct =  $web.Conte ntTypes[$c tName];
  355       if(!$c t.Fields.C ontainsFie ldWithStat icName($sF ieldStatic Name)){
  356                $field=$ web.Fields .TryGetFie ldByStatic Name($sFie ldStaticNa me)
  357                $link =  new-object  Microsoft .SharePoin t.SPFieldL ink $field
  358           #c heck if co mments fie lds exist  or not.
  359           if (($ct.Fiel dLinks | W here-Objec t {$_.Name  -eq $sFie ldInternal Name}) -EQ  $null) {
  360                    $ct. FieldLinks .Add($link )
  361                    $ct. Update($tr ue)
  362                Write-Ho st $sField InternalNa me Field h as been ad ded to $ct  -Foregrou ndColor Gr een
  363           }
  364           el se {
  365                Write-Ho st $sField InternalNa me Field a lready exi st -Foregr oundColor  Yellow
  366           }
  367       }
  368   }
  369  
  370  
  371   function S et-SiteCol umn([Micro soft.Share Point.SPSe curableObj ect]$web,  [String]$s FieldDispl ayName,[St ring]$sFie ldStaticNa me, [Strin g]$sFieldI nternalNam e, [Micros oft.ShareP oint.SPFie ldType]$sF ieldType,  [System.Co llections. Specialize d.StringCo llection]  $sChoice,  [String]$s pFieldGrou p, [switch ] $isRequi red, [swit ch] $showI nEditForm,  [switch]  $showInNew Form) {
  372       $web =  (Get-Site Web)
  373       if (!$ web.Fields .ContainsF ieldWithSt aticName($ sFieldStat icName)){
  374                $sFieldD isplayName =$sFieldDi splayName 
  375                    writ e-Host "Ad ding the f ield $sFie ldDisplayN ame to the  Site" -fo regroundco lor cyan    
  376                $sFieldS taticName  = $web.Fie lds.Add($s FieldInter nalName,$s FieldType,  $false, $ false, $sC hoice);
  377                    $spF ield=$web. Fields.Try GetFieldBy StaticName ($sFieldSt aticName)
  378                    $spF ield.Group = $spField Group 
  379                    $spF ield.Title =$sFieldDi splayName 
  380                
  381                if($isRe quired) {$ spField.Re quired = $ True}
  382                if($show InEditForm ) {$spFiel d.ShowInEd itForm = $ True}
  383                if($show InNewForm)  {$spField .ShowInNew Form = $Tr ue}
  384  
  385                    $spF ield.Updat e()  
  386       }
  387       else {
  388            W rite-Host  $sFieldInt ernalName  Field alre ady exist  -Foregroun dColor Yel low
  389       }
  390   }
  391   function S et-SiteCol umnLookup( [Microsoft .SharePoin t.SPSecura bleObject] $web, [Str ing]$sFiel dStaticNam e, [String ]$sFieldDi splayName,  [String]$ lookupList Title, [St ring]$spFi eldGroup)  {
  392       if (!$ web.Fields .ContainsF ieldWithSt aticName($ sFieldStat icName)){        
  393                    writ e-Host "Ad ding the f ield $sFie ldDisplayN ame to the  Site" -fo regroundco lor cyan                 
  394                    $sFi eldStaticN ame = $web .Fields.Ad dLookup($s FieldDispl ayName,(($ web.Lists. TryGetList ($lookupLi stTitle)). Id), $fals e);             
  395                    $spF ield=$web. Fields.Try GetFieldBy StaticName ($sFieldSt aticName)
  396                    $spF ield.Group = $spField Group 
  397                    $spF ield.Title =$sFieldDi splayName 
  398                    $spF ield.Updat e()  
  399       }
  400       else {
  401            W rite-Host  $sFieldInt ernalName  Field alre ady exist  -Foregroun dColor Yel low
  402       }
  403   }
  404  
  405   function U pdate-Site ColumnLook up ($siteC olumnTitle ,$lookupLi stTitle,$l ookupListF ieldTitle) {
  406       $siteC olumnFld =  ($webSite .Fields |  ? {$_.Titl e -match $ siteColumn Title})
  407       $listL ookup = $w ebSite.Lis ts.TryGetL ist($looku pListTitle )
  408       $siteC olumnFld.L ookupList  = $listLoo kup.ID
  409       $siteC olumnFld.L ookupField  = $lookup ListFieldT itle
  410       $siteC olumnFld.U pdate()
  411   }
  412  
  413   #region Ad d-Facility Workflow
  414   function A dd-Facilit yWorkflow  ($oldFeatu reName, $f eatureTemp lateName,  $newFeatur eId, $sear chDisplay,  $listName , $unInsta ll)
  415   {
  416       $bolEn ableFeatur eOnly = $F alse #init ialize
  417           #  GET THE SI TE
  418       $_site URL = Get- SiteURL
  419       $w = G et-SPWeb $ _siteURL
  420  
  421       Write- Host ([Str ing]::Form at("Proces ing web {0 }",$w.Url) ) -foregro undcolor C yan             
  422  
  423       if($w. Webs.Count  -gt 0)
  424       {
  425           fo reach($web  in $w.Web s)
  426           {    
  427                #Enable  old workfl ows from 2 .1 or befo re
  428                if($oldF eatureName  -contains  "*IACUC*"  -or $oldF eatureName  -contains  "*RDC*")  {             
  429                    Enab le-SPFeatu re -Identi ty $oldFea tureName - Url $web.U rl -Verbos e -Force
  430                    Enab le-SPFeatu re -Identi ty $oldFea tureName - Url $siteU rl -Verbos e -Force
  431                }
  432                $web.Upd ate()
  433                #get abo ve old wor kflows
  434                $Oldfeat ure = $nul l #initial ize
  435  
  436                if($bolE nableFeatu reOnly -eq  $False) {
  437                    try  {
  438                    $Old feature =  Get-SPFeat ure -Ident ity $oldFe atureName  -Web $_sit eURL -Erro rAction Ig nore -Verb ose
  439                    }
  440                    catc h {
  441                         Write-Host  "Feature:  $oldFeatu reName doe s not exis t for Site : $web.Url "
  442                    }
  443                }
  444                $tempFea tureId = $ null
  445                if($Oldf eature -ne  $null) {
  446                    $tem pFeatureId  = $Oldfea ture.Id              
  447                }
  448                if ($tem pFeatureId  -eq $null )
  449                {
  450                    $tem pFeatureId  = $newFea tureId
  451                }
  452                Write-Ho st "Callin g Deploy-F eature on  $web with  $featureTe mplateName  OldFeatur eId $tempF eatureId F eatureId $ newFeature Id "
  453                if($bolE nableFeatu reOnly -eq  $False) {
  454                    Depl oy-Feature  -SiteColl ection $_s iteURL -si te $web.Ur l -Feature Name $feat ureTemplat eName -Old FeatureId  $tempFeatu reId -Feat ureId $new FeatureId  -file $scr ipt -bolUn install $u nInstall - bolEnableF eatureOnly  $bolEnabl eFeatureOn ly
  455                    $bol EnableFeat ureOnly =  $True
  456                }
  457                else {
  458                    Depl oy-Feature  -SiteColl ection $_s iteURL -si te $web.Ur l -Feature Name $feat ureTemplat eName -Old FeatureId  $tempFeatu reId -Feat ureId $new FeatureId  -file $scr ipt -bolUn install $u nInstall - bolEnableF eatureOnly  $bolEnabl eFeatureOn ly
  459                }
  460           }
  461       }
  462   }
  463   #endregion  
  464  
  465   #region Ad d Site Col lection le vel workfl ow
  466   function A dd-SiteCol lectionWor kFlow ($fe atureTempl ateName, $ newFeature Id, $oldFe atureId, $ searchDisp lay, $unIn stall) {
  467    try
  468       {    
  469                # GET TH E SITE
  470           $_ siteURL =  Get-SiteUR L
  471           $w  = Get-SPW eb $_siteU RL
  472           Wr ite-Host ( [String]:: Format("Pr ocesing we b {0}",$w. Url)) -for egroundcol or Cyan             
  473        
  474           #$ featureTem plateName= "Notificat ion Workfl ow Configu ration Wor kflow.wsp"
  475           #$ newFeature Id="df4391 92-e32f-47 60-9bef-d2 39d8519593 "
  476           
  477           $t empFeature Id = $Null
  478           $O ldfeature  = Get-SPFe ature -Lim it ALL  -W eb $w.Url  | Where-Ob ject {$_.D isplayName  -like $se archDispla y}            
  479  
  480           if ($Oldfeatu re -ne $Nu ll) {
  481                $tempFea tureId = $ Oldfeature .Id
  482           }
  483           if  ($tempFea tureId -eq  $null)
  484           {
  485                $tempFea tureId = $ oldFeature Id
  486           }
  487           Wr ite-Host " Calling De ploy-Featu re on $w w ith $featu reTemplate Name OldFe atureId $t empFeature Id Feature Id $newFea tureId "
  488           De ploy-Featu re -SiteCo llection $ _siteURL - site $w.Ur l -Feature Name $feat ureTemplat eName -Old FeatureId  $tempFeatu reId -Feat ureId $new FeatureId  -file $scr ipt -bolUn install $u nInstall - bolEnableF eatureOnly  $False         
  489  
  490       }
  491       catch
  492       {
  493           Wr ite-Host ( [String]:: Format("Er ror proces sing web a t $_siteUR L, with Ex ception: { 0}", $_.Ex ception.Me ssage)) -f oregroundc olor Red
  494       }  
  495   }
  496   #endregion
  497  
  498   #region ut ility func tions Get- DateFromDa ys, Format -ListOutpu t, Get-Lis tInternalN ame
  499   function G et-DateFro mDays ($mi nusdays) {
  500       $days  = $minusda ys 
  501       $count  = $collLi stItems.Co unt;
  502       $date  = get-date ;
  503       return  $date.Add Days($days );
  504  
  505   }
  506  
  507   function F ormat-List Output($li stTable) {
  508     $listTab le | Forma t-List
  509   }
  510  
  511   function G et-ListInt ernalName  ($staticNa me, $list)  {
  512       $list. Fields.Try GetFieldBy StaticName ($staticNa me).Intern alName
  513       return ;
  514   }
  515   function G et-SPList( $web, $Nam e, $Url, $ subWeb) {
  516      $list =  $null
  517       try {   
  518           if ($subWeb - eq $null)  {  
  519                $list =  $web.GetLi stFromURL( $Url) 
  520            }
  521            e lse {
  522                $list =  $subWeb.Ge tListFromU RL($Url) 
  523            }
  524           re turn $list
  525       }
  526       catch  {
  527          try  {
  528           if ($subWeb - eq $null)  {  
  529                $list =  $web.GetLi st($Name) 
  530            }
  531            e lse {
  532                $list =  $subWeb.Ge tList($Nam e) 
  533            }
  534            r eturn $lis t
  535           }
  536                catch {   
  537              return $li st           
  538           }
  539       }   
  540   }
  541  
  542  
  543   function R emove-Data FromAList  ($Site, $s ubSite, $f ilterDate,  $listUrl,  $listName )
  544   {
  545       #get a  collectio n of ids
  546       $items ToDelete =  New-Objec t System.C ollections .ArrayList
  547       $list  = Get-SPLi st -web $S ite -Name  $listName  -Url $list Url -subWe b $subSite
  548       #get a pplication  list
  549       if($li st -ne $nu ll)
  550       {
  551           #G et all ite ms in this  list and  save them  to a varia ble
  552           $i tems = $li st.items
  553           $i temCount =  0
  554           #G o through  all items
  555           Wr ite-Host T otal Items  in the $l ist.Entity TypeName :  $items.Co unt -Foreg roundColor  Green
  556           fo reach($ite m in $item s)
  557           {
  558                if($item ["Created" ] -lt $fil terDate)
  559                { 
  560                    #add  each item  id to the  delete li st  
  561                    Writ e-Host Add  item# $it emCount  f rom the li st for Stu dy#: $item ["Title"]  on $item[" Created"]  -Foregroun dColor Cya n                                    
  562                    $ite msToDelete .Add($item .ID)                 
  563                    $ite mCount ++;
  564                }             
  565           }         
  566           #n ow start d eleting th ose items
  567           if ($itemCoun t -eq 0) {
  568                Write-Ho st Nothing  to delete , count: $ itemCount   -Foregrou ndColor Ye llow
  569            r eturn
  570           }
  571           Wr ite-Host T otal items  to be del eted $item Count  -Fo regroundCo lor Yellow
  572           fo reach($ite mToDelete  in $itemsT oDelete) {
  573                Write-Ho st Deletin g item# $i temToDelet e -Foregro undColor C yan  
  574                $items.D eleteItemB yId($itemT oDelete);                                                                                                              
  575           }
  576           $i tems.Updat e();
  577           $l ist.Update ();
  578           Wr ite-Host T otal Items  After $li st.items.C ount  -For egroundCol or Green         
  579       }
  580       else
  581       {
  582           Wr ite-Host N o list fou nd by the  name: $lis tUrl
  583       }
  584   }
  585   #endregion
  586  
  587   #region Mo dule Manif est
  588   function U pdate-Util MF {
  589       New-Mo duleManife st -Path . \RAMS_Modu le_Util.ps d1 -Module Version 1. 0.0 -Autho r "Chita N ilak, ByLi ght" -Root Module .\R AMS_Module _Util.psm1  -Descript ion "RAMS  Utility Fu nctions" - CompanyNam e "VA.GOV. RAMS" -Ver bose 
  590   }
  591   #endregion
  592  
  593   #region 
  594   #New-RAMSE nvironment
  595   function G et-RAMSEnv  ($host) {
  596       $_host  = $host
  597       $_env  = Get-Cont ent .\Env. json | Con vertFrom-J son
  598       $_serv er = $null
  599       switch  ($_host)  {
  600           $_ env.DEV.sp  {$_server  = $_env.D EV}    
  601           $_ env.TEST.s p {$_serve r = $_env. TEST}    
  602           $_ env.PPD.sp  {$_server  = $_env.P PD}    
  603           $_ env.SQA.sp  {$_server  = $_env.S QA}    
  604           $_ env.PROD.s p {$_serve r = $_env. PROD}    
  605       }
  606       return  $_server
  607   }
  608  
  609   function N ew-RAMSEnv  {
  610  
  611       $_serv erEnv = @{
  612           DE V = @{
  613                                   "sp" = " DNS    ";                                                      
  614                                   "sql" = " DN S     ";
  615                                                             "ssrs" = " DN S     ";
  616                                                            "superRe ader" = @( "",""); #R EAD-ONLY a ccess to R AMS-DB
  617                                                            "farmUse r" = @("", ""); #Shar ePoint Far m Account  w/ local A dmin permi ssion                                                                       
  618                                                   }; #DE V
  619           TE ST = @{
  620                                   "sp" = " DNS    ";                                                      
  621                                                             "sql" = " DN S     ";
  622                                                             "ssrs" = " DN S     ";
  623                                                            "superRe ader" = @( "",""); #R EAD-ONLY a ccess to R AMS-DB
  624                                                            "farmUse r" = @("", ""); #Shar ePoint Far m Account  w/ local A dmin permi ssion                                                                       
  625                                                   }; #TE ST
  626           SQ A = @{
  627                                   "sp" = " DNS    ";                                                      
  628                                                             "sql" = " DNS ";
  629                                                             "ssrs" = " DNS ";
  630                                                            "superRe ader" = @( "",""); #R EAD-ONLY a ccess to R AMS-DB
  631                                                            "farmUse r" = @("", ""); #Shar ePoint Far m Account  w/ local A dmin permi ssion                                                                       
  632                                                   }; #SQ A
  633           PP D = @{
  634                                   "sp" = " DNS    ";                                                      
  635                                                             "sql" = " DNS ";
  636                                                             "ssrs" = " DNS ";
  637                                                            "superRe ader" = @( "",""); #R EAD-ONLY a ccess to R AMS-DB
  638                                                            "farmUse r" = @("", ""); #Shar ePoint Far m Account  w/ local A dmin permi ssion                                                                       
  639                                                   }; #PP D
  640           PR OD = @{
  641                                   "sp" = " DNS    APPRAM20";                                                       
  642                                                             "sql" = " DNS ";
  643                                                             "ssrs" = " DNS ";
  644                                                            "superRe ader" = @( "",""); #R EAD-ONLY a ccess to R AMS-DB
  645                                                            "farmUse r" = @("", ""); #Shar ePoint Far m Account  w/ local A dmin permi ssion                                                                       
  646                                                   }; #PR OD
  647       }
  648       if((Ge t-ChildIte m ".\" -Fi lter "ENV. json") -ne  $null) {                                         
  649           Re move-Item  .\ENV.json  -Verbose
  650       }
  651       Conver tTo-json $ _serverEnv  -Compress  | New-Ite m -Name EN V.json -Pa th .\ -Ite mType file  -Force
  652       return  Get-Conte nt .\Env.j son | Conv ertFrom-Js on
  653   }
  654   function G et-Facilit ySites {
  655       $webs  = Get-Site Web 
  656       $_faci lities = N ew-Object  System.Col lections.A rrayList     
  657       foreac h($web in  $webs.Webs ) {         
  658          $_f acilities. Add($web.N ame)        
  659       }
  660       #retur n
  661       $_faci lities
  662   }
  663   function N ew-RAMSGro up ($facil ity, $newG roupName,  $newGroupP ermission,  $groupOwn erSuffix,  $newGroupD escSuffix)  {
  664       
  665       #Get s ite and Gr oup object s  
  666       $_url  = Get-Site URL 
  667       $_Site  = Get-SPS ite -Ident ity $_url
  668       
  669       #add n ew securit y group
  670       $_site Groups = $ _Site.Root Web.SiteGr oups
  671       $_owne rGroup = $ _siteGroup s["$facili ty $groupO wnerSuffix "]
  672       
  673       #check  if the gr oup alread y exist
  674       try {
  675           $_ siteGroups .Add("$fac ility $new GroupName" ,$_ownerGr oup,$null, "$facility  $newGroup DescSuffix ")
  676       }    
  677       catch  {
  678           $_ siteGroups .Remove("$ facility $ newGroupNa me")
  679           $_ siteGroups .Add("$fac ility $new GroupName" ,$_ownerGr oup,$null, "$facility  $newGroup DescSuffix ")
  680       }
  681       $_Site .RootWeb.U pdate()
  682  
  683       #Chang e AO group  permissio n at site  collection  level to  EDIT
  684       $role  = $_Site.R ootWeb.Rol eDefinitio ns[$newGro upPermissi on]
  685       $_newG roup = $_S ite.RootWe b.SiteGrou ps["$facil ity $newGr oupName"]
  686       $RoleA ssignment  = New-Obje ct Microso ft.SharePo int.SPRole Assignment ($_newGrou p)
  687       $RoleA ssignment. RoleDefini tionBindin gs.Add($ro le)
  688  
  689       # the  following  could be f or a web,  list or it em object
  690       $_Site .RootWeb.R oleAssignm ents.Add($ RoleAssign ment)
  691       $_Site .RootWeb.U pdate()
  692       Write- Host """$f acility $n ewGroupNam e"" has be en added w / ""$newGr oupPermiss ion"" perm ission on  $_Site" -F oregroundC olor yello w
  693       
  694       #dispo se site ob ject   
  695       $_Site .Dispose() ;  
  696   }
  697   function A dd-Facilit yGroup ($n ewGroupNam e, $newGro upPermissi on) {
  698       $_faci lityWebs =  Get-SiteW eb
  699       $_faci lityList =  $_facilit yWebs.GetL istFromUrl ("Lists/Fa cility/All Items.aspx ")
  700  
  701       #add e ach new gr oups to th e respecti ve facilit y sub-site .
  702       foreac h ($item i n $_facili tyList.Ite ms) {
  703           #f acility su b-site
  704           $f acilitySub site = $it em["Facili ty Subsite "]
  705           #f acility na me
  706           $f acilityNam e = $item[ "Facility  Name"]
  707           #f oreach
  708           fo reach ($fa cilityWeb  in $_facil ityWebs.We bs) {
  709                if($faci litySubsit e.IndexOf( $facilityW eb.Name) - gt 0) {
  710                    #get  role
  711                    $rol e = $facil ityWeb.Rol eDefinitio ns[$newGro upPermissi on]
  712                    $_ne wGroup = $ _facilityW ebs.SiteGr oups["$fac ilityName  $newGroupN ame"]
  713                    $Rol eAssignmen t = New-Ob ject Micro soft.Share Point.SPRo leAssignme nt($_newGr oup)
  714                    $Rol eAssignmen t.RoleDefi nitionBind ings.Add($ role)
  715  
  716                    # th e followin g could be  for a web , list or  item objec t
  717                    $fac ilityWeb.R oleAssignm ents.Add($ RoleAssign ment)
  718                    $fac ilityWeb.U pdate()
  719                    Writ e-Host """ $_newGroup "" has bee n added w/  ""$newGro upPermissi on"" permi ssion on $ facilityWe b" -Foregr oundColor  yellow             
  720                
  721                    #$it em["Resear ch Complia nce Office rs"]         
  722                }
  723                $facilit yWeb.Updat e()
  724           }     
  725       }
  726   }
  727  
  728   function R emove-Work Flow ([str ing] $wfMa tchName, $ wfWeb) {
  729       $wfm =  New-Objec t Microsof t.SharePoi nt.Workflo wServices. WorkflowSe rvicesMana ger($wfWeb );
  730  
  731       $wfss  =$wfm.GetW orkflowSub scriptionS ervice()
  732  
  733       $wfis= $wfm.GetWo rkflowInst anceServic e()
  734  
  735       #$wfss .Enumerate Subscripti ons()
  736  
  737       foreac h($item in  $wfss.Enu merateSubs criptions( )){         
  738           if ($item.Nam e -match $ wfMatchNam e){
  739                $wfss.De leteSubscr iption($it em.Id)
  740                Write-Ho st ($item. Name) Work Flow has b een remove d from $wf Web -Foreg roundColor  Yellow
  741           }
  742       }
  743       $wfWeb .Update()     
  744   }
  745   function R ename-List ($spWeb,$l istName,$n ewTitle) {
  746       ForEac h($culture  in $spWeb .Supported UICultures )
  747       {
  748           [S ystem.Thre ading.Thre ad]::Curre ntThread.C urrentUICu lture=$cul ture;
  749           #c heck if th e list has  already b een named  or not
  750           if (($spWeb.L ists.TryGe tList($new Title)) -e q $null) {
  751                $list =  $spWeb.Lis ts.TryGetL ist($listN ame) 
  752                $list.Ti tle = $new title;                      
  753                $list.Ro otFolder.M oveTo($new title)
  754                $list.Up date();
  755           }         
  756       }
  757       $spWeb .Dispose()
  758   }
  759  
  760   function C lone-Calen dar($spWeb , $calName ,$OldCalNa me, $calTi tle) 
  761   {  
  762       $SPTem plate = (G et-SiteWeb ).ListTemp lates["Cal endar"]
  763       
  764       $newCa l = $spWeb .Lists.Try GetList($c alTitle)
  765       #remov e if the c lone list  already ex ist
  766       if($ne wCal -ne $ null) {     
  767           $s pWeb.Lists .Delete($n ewCal.ID)
  768           $s pWeb.Updat e()
  769       }
  770       #creat e a new cl one list
  771       $spWeb .Lists.Add ($calTitle ,$calTitle ,$SPTempla te)
  772       $spWeb .Update()
  773       
  774       #get o ld list (a fter renam e)    
  775       $oldLi st = $spWe b.Lists.Tr yGetList($ OldCalName )
  776  
  777       #get n ew list 
  778       $newLi st = $spWe b.Lists.Tr yGetList($ calTitle)
  779                   
  780       if($ol dList -ne  $null)
  781       {
  782           
  783           fo reach($old Fld in $ol dList.Fiel ds) {             
  784                if(($new List.Field s.Contains FieldWithS taticName( $oldFld.St aticName)  -eq $False ) -and 
  785                       ( $newList.F ields.Cont ainsField( $oldFld.Ti tle) -eq $ False))
  786                {           
  787                             $newLi st.Fields. Add($oldFl d);
  788                    $new List.Updat e()
  789                    Writ e-Host $ol dFld has b een added  to $newLis t -Foregro undColor G reen
  790                }
  791                else {
  792                    Writ e-Host $ol dFld alrea dy exist i n $newList  -Foregrou ndColor Ye llow
  793                }
  794           }
  795           
  796           $s pWeb.Updat e()
  797           #s et default  view
  798           $n ewView = $ newList.Vi ews | ? {  $_.Title - eq 'All Ev ents' };
  799  
  800           <# add old vi ew
  801           $o ldView = $ oldList.Vi ews | ? {  $_.Title - eq 'All Ev ents' };
  802           #s et default  view
  803           $n ewView = $ newList.Vi ews | ? {  $_.Title - eq 'All Ev ents' };
  804           #c lone view  fields
  805           fo reach($old ViewFld in  $oldView. ViewFields ){
  806                if($newV iew.ViewFi elds.exist s($oldView Fld)) {
  807                    Writ e-Host ($o ldViewFld)  already e xist in $n ewView -Fo regroundCo lor Yellow
  808                }
  809                else {
  810                    $new View.ViewF ields.Add( $oldViewFl d)
  811                    Writ e-Host ($o ldViewFld)  has been  added to $ newView -F oregroundC olor Green
  812                }
  813           }
  814           #>
  815           $c ontentType  = "Event"
  816           $n ewFieldOrd er = @("Ti tle", "Eve ntDate", " EndDate",  "Location" , "fAllDay Event", "f Recurrence ","EventAt tendees",  "EventComm itteeAtten dees",  "P articipant sPicker"," Administra tive_x0020 _Items", " TaxKeyword ", "Approv edApplicat ionLookup" , "IACUCMe etingMinut eLookup",  "RDCMeetin gMinuteLoo kup", "Dec ision", 
  817           "D eliberatio n"
  818           )
  819                $ct = $n ewList.Con tentTypes[ $contentTy pe]       
  820                $ct.Fiel dLinks.Reo rder($newF ieldOrder)
  821                $ct.Upda te() 
  822                $newList .Update()
  823           #s et as defa ult view
  824           $n ewView.Def aultView =  $true
  825           $n ewView.Upd ate()
  826           #m igrate dat a from old  list to n ew list
  827           $n ewItem = $ null
  828           fo reach($old Item in $o ldList.Ite ms) {
  829                $newItem  = $newLis t.AddItem( )
  830                foreach( $fld in $o ldItem.Fie lds) {
  831                  if(($n ewList.Fie lds.Contai nsField($f ld.Title)  -eq $True) ) {  
  832                    if(" ID","WF"," Link","_", "Agenda"," Attachment s","Facili ties" -not contains $ fld.Static Name){
  833                         if($fld.Re adOnlyFiel d -eq $Fal se) {
  834                             $newIt em[$fld.St aticName]  = $oldItem [$fld.Stat icName]
  835                             Write- Host Item:  $newItem[ $fld.Stati cName] has  been adde d to the $ newList -F oregroundC olor Cyan              
  836                         }               
  837                     } 
  838                   } 
  839                 }
  840                $newItem .Update()              
  841           }
  842           $n ewList.Upd ate()
  843       }
  844   }
  845   function R emove-Site Pages ([st ring[]]$si tePages) {
  846       foreac h($page in  $sitepage s) {
  847           $t argetPage  = ((Get-Si teWeb).Lis ts["Site P ages"]).It ems | ? {$ _.Name -eq  $page} 
  848           if ($targetPa ge -ne $Nu ll) {
  849                $targetP age.Delete () 
  850                Write-Ho st $page h as been de leted from  Site Coll ection: (G et-SiteWeb ) -Foregro undColor Y ellow
  851           }
  852       }
  853   }
  854   function R emove-Site Assets ([s tring[]]$s iteAssets)  {
  855       foreac h($asset i n $siteass ets) {
  856           $t argetAsset  = ((Get-S iteWeb).Li sts["Site  Assets"]). Items | ?  {$_.Name - eq $asset}  
  857           if ($targetAs set -ne $N ull) {
  858                $targetA sset.Delet e() 
  859                Write-Ho st $asset  has been d eleted fro m Site Col lection: ( Get-SiteWe b) -Foregr oundColor  Yellow
  860           }
  861       }
  862   }
  863  
  864   function R emove-Faci litySitePa ges ([stri ng[]]$site Pages) {
  865       foreac h ($subWeb  in (Get-S iteWeb).We bs) {         
  866           fo reach($pag e in $site pages) {
  867                $targetP age = ($su bWeb.Lists ["Site Pag es"]).Item s | ? {$_. Name -eq $ page} 
  868                if($targ etPage -ne  $Null) {
  869                    $tar getPage.De lete() 
  870                    Writ e-Host ($t argetPage. Name) has  been delet ed from $s ubWeb -For egroundCol or Yellow
  871                }
  872           }
  873       }
  874   }
  875   function R emove-Faci litySiteAs sets ([str ing[]]$sit eAssets) {
  876       foreac h ($subWeb  in (Get-S iteWeb).We bs) {
  877           fo reach($ass et in $sit eassets) {
  878                $targetA sset = ($s ubWeb.List s["Site As sets"]).It ems | ? {$ _.Name -eq  $asset} 
  879                if($targ etAsset -n e $Null) {
  880                    $tar getAsset.D elete() 
  881                    Writ e-Host ($t argetAsset .Name) has  been dele ted from $ subWeb -Fo regroundCo lor Yellow
  882                }
  883           }
  884       }
  885   }
  886   function N ew-SpListV iew ([Syst em.Collect ions.Speci alized.Str ingCollect ion] $fldL ist, $view Title, $li stName,$vi ewQuery,$v iewRowLimi t) {
  887  
  888       #Get d estination  site and  list
  889       $web =  Get-SPWeb  -Identity  (Get-Site URL)    
  890       $list  = $web.Get List($web. ServerRela tiveUrl.Tr imEnd("/")  + "/Lists /$listName ")
  891       
  892       #Title  property
  893       $viewT itle = $vi ewTitle
  894       $View  = $list.Vi ews[$viewT itle]
  895       if ($V iew -ne $n ull) {
  896               $list.Vie ws.Delete( $View.ID)
  897               $list.Upd ate()
  898       }
  899           #A dd the col umn names  from the V iewField p roperty to  a string  collection
  900       $viewF ields = Ne w-Object S ystem.Coll ections.Sp ecialized. StringColl ection
  901       foreac h ($fldNam e in $fldL ist) {
  902           $v iewFields. Add($fldNa me) > $nul l
  903       }
  904  
  905       #Paged  property
  906       $viewP aged = $tr ue
  907  
  908       #Defau ltView pro perty
  909       $viewD efaultView  = $false
  910  
  911       #Creat e the view  in the de stination  list
  912       $newvi ew = $list .Views.Add ($viewTitl e, $viewFi elds, $vie wQuery, $v iewRowLimi t, $viewPa ged, $view DefaultVie w)
  913       Write- Host ("Vie w '" + $ne wview.Titl e + "' has  been adde d to the l ist '" + $ list.Title  + "' on s ite " + $w eb.Url) -F oregroundC olor Green
  914  
  915       #updat e view and  list
  916       $newvi ew.Update( )
  917       $list. Update()     
  918   }
  919  
  920   function U pdate-SpLi stView ([S ystem.Coll ections.Sp ecialized. StringColl ection] $f ldList, $l istName) {
  921       #Get d estination  site and  list
  922       $web =  Get-SPWeb  -Identity  (Get-Site URL)    
  923       $list  = $web.Get List($web. ServerRela tiveUrl.Tr imEnd("/")  + "/Lists /$listName ")
  924       
  925       #Updat e Views
  926       try {
  927           fo reach($Vie w in $list .Views) {
  928                #Add the  column na mes from t he ViewFie ld propert y to a str ing collec tion
  929                $viewFie lds = $Vie w.ViewFiel ds
  930                foreach  ($fldName  in $fldLis t) {
  931                    $Vie wFields.Ad d($fldName ) > $null
  932                }    
  933                #update  view and l ist         
  934                $View.Up date()
  935                Write-Ho st ("View  '" + $View .Title + " ' has been  updated f or the lis t: '" + $l ist.Title  + "' on si te " + $we b.Url) -Fo regroundCo lor Green
  936          }
  937      }
  938      catch {
  939       #do no thing.
  940      }
  941      finally  {
  942       $list. Update()
  943      }
  944   }
  945  
  946   Function R emove-Cont entTypeFro mList()
  947   {
  948       param
  949       (
  950           [P arameter(M andatory=$ true)] [st ring] $Sit eURL,
  951           [P arameter(M andatory=$ true)] [st ring] $Lis tName,
  952           [P arameter(M andatory=$ true)] [st ring] $Con tentTypeNa me
  953       )
  954    
  955       Try {
  956  
  957           Ad d-Type -Pa th "C:\Pro gram Files \Common Fi les\Micros oft Shared \Web Serve r Extensio ns\15\ISAP I\Microsof t.SharePoi nt.Client. Runtime.dl l"
  958           Ad d-Type -Pa th "C:\Pro gram Files \Common Fi les\Micros oft Shared \Web Serve r Extensio ns\15\ISAP I\Microsof t.SharePoi nt.Client. dll"
  959  
  960             $Credentia ls = New-O bject Syst em.Net.Net workCreden tial("
A
I
","
A I "," DN S         ")
  961            
  962           #S etup the c ontext
  963           $C tx = New-O bject Micr osoft.Shar ePoint.Cli ent.Client Context($S iteURL)
  964           $C tx.Credent ials = $Cr edentials
  965        
  966           #G et the Lis t
  967           $L ist = $Ctx .Web.Lists .GetByTitl e($ListNam e)
  968           $C tx.Load($L ist)
  969    
  970           #G et the con tent type  from list
  971           $C ontentType Coll = $Li st.Content Types
  972           $C tx.Load($C ontentType Coll)
  973           $C tx.Execute Query()
  974    
  975           #G et the con tent type  to remove
  976           $C TypeToRemo ve = $Cont entTypeCol l | Where  {$_.Name - eq $Conten tTypeName}
  977           If ($CTypeToR emove -ne  $Null)
  978           {
  979                #Remove  content ty pe from li st
  980                $CTypeTo Remove.Del eteObject( )
  981                $Ctx.Exe cuteQuery( )
  982    
  983                Write-ho st "Conten t Type '$C ontentType Name' Remo ved From ' $ListName' " -f Green
  984           }
  985           el se
  986           {
  987                Write-ho st "Conten t Type '$C ontentType Name' does n't exists  in '$List Name'" -f  Yellow
  988                Return
  989           }
  990      }
  991       Catch  {
  992           wr ite-host - f Red "Err or Removin g Content  Type from  List!" $_. Exception. Message
  993       }
  994   }
  995  
  996  
  997   function C opy-SpList ($spWeb, $ calName,$O ldCalName,  $calTitle
  998   {  
  999       $SPTem plate = (G et-SiteWeb ).ListTemp lates["Cal endar"]
  1000       
  1001       $newCa l = $spWeb .Lists.Try GetList($c alTitle)
  1002       #remov e if the c lone list  already ex ist
  1003       if($ne wCal -ne $ null) {     
  1004           $s pWeb.Lists .Delete($n ewCal.ID)
  1005           $s pWeb.Updat e()
  1006       }
  1007       #creat e a new cl one list
  1008       $spWeb .Lists.Add ($calTitle ,$calTitle ,$SPTempla te)
  1009       $spWeb .Update()
  1010       
  1011       #get o ld list (a fter renam e)    
  1012       $oldLi st = $spWe b.Lists.Tr yGetList($ OldCalName )
  1013  
  1014       #get n ew list 
  1015       $newLi st = $spWe b.Lists.Tr yGetList($ calTitle)
  1016                   
  1017       if($ol dList -ne  $null)
  1018       {
  1019           
  1020           fo reach($old Fld in $ol dList.Fiel ds) {             
  1021                if(($new List.Field s.Contains FieldWithS taticName( $oldFld.St aticName)  -eq $False ) -and 
  1022                       ( $newList.F ields.Cont ainsField( $oldFld.Ti tle) -eq $ False))
  1023                {           
  1024                             $newLi st.Fields. Add($oldFl d);
  1025                    $new List.Updat e()
  1026                    Writ e-Host $ol dFld has b een added  to $newLis t -Foregro undColor G reen
  1027                }
  1028                else {
  1029                    Writ e-Host $ol dFld alrea dy exist i n $newList  -Foregrou ndColor Ye llow
  1030                }
  1031           }
  1032           
  1033           $s pWeb.Updat e()
  1034           #s et default  view
  1035           $n ewView = $ newList.Vi ews | ? {  $_.Title - eq 'All Ev ents' };
  1036  
  1037           <# add old vi ew
  1038           $o ldView = $ oldList.Vi ews | ? {  $_.Title - eq 'All Ev ents' };
  1039           #s et default  view
  1040           $n ewView = $ newList.Vi ews | ? {  $_.Title - eq 'All Ev ents' };
  1041           #c lone view  fields
  1042           fo reach($old ViewFld in  $oldView. ViewFields ){
  1043                if($newV iew.ViewFi elds.exist s($oldView Fld)) {
  1044                    Writ e-Host ($o ldViewFld)  already e xist in $n ewView -Fo regroundCo lor Yellow
  1045                }
  1046                else {
  1047                    $new View.ViewF ields.Add( $oldViewFl d)
  1048                    Writ e-Host ($o ldViewFld)  has been  added to $ newView -F oregroundC olor Green
  1049                }
  1050           }
  1051           #>
  1052           $c ontentType  = "Event"
  1053           $n ewFieldOrd er = @("Ti tle", "Eve ntDate", " EndDate",  "Location" , "fAllDay Event", "f Recurrence ","EventAt tendees",  "EventComm itteeAtten dees",  "P articipant sPicker"," Administra tive_x0020 _Items", " TaxKeyword ", "Approv edApplicat ionLookup" , "IACUCMe etingMinut eLookup",  "RDCMeetin gMinuteLoo kup", "Dec ision", 
  1054           "D eliberatio n"
  1055           )
  1056                $ct = $n ewList.Con tentTypes[ $contentTy pe]       
  1057                $ct.Fiel dLinks.Reo rder($newF ieldOrder)
  1058                $ct.Upda te() 
  1059                $newList .Update()
  1060           #s et as defa ult view
  1061           $n ewView.Def aultView =  $true
  1062           $n ewView.Upd ate()
  1063           #m igrate dat a from old  list to n ew list
  1064           $n ewItem = $ null
  1065           fo reach($old Item in $o ldList.Ite ms) {
  1066                $newItem  = $newLis t.AddItem( )
  1067                foreach( $fld in $o ldItem.Fie lds) {
  1068                  if(($n ewList.Fie lds.Contai nsField($f ld.Title)  -eq $True) ) {  
  1069                    if(" ID","WF"," Link","_", "Agenda"," Attachment s","Facili ties" -not contains $ fld.Static Name){
  1070                         if($fld.Re adOnlyFiel d -eq $Fal se) {
  1071                             $newIt em[$fld.St aticName]  = $oldItem [$fld.Stat icName]
  1072                             Write- Host Item:  $newItem[ $fld.Stati cName] has  been adde d to the $ newList -F oregroundC olor Cyan              
  1073                         }               
  1074                     } 
  1075                   } 
  1076                 }
  1077                $newItem .Update()              
  1078           }
  1079           $n ewList.Upd ate()
  1080       }
  1081   }
  1082  
  1083   #endregion
  1084  
  1085   #Custom Fu nction to  delete a c olumn with  PowerShel l
  1086   Function R emove-Colu mnFromList  ($WebURL,  $ListName , $ColumnN ame)
  1087   {
  1088    
  1089       #Get I nternal Na me of the  columns
  1090       $web =  Get-SPWeb  $WebURL
  1091    
  1092       #Get t he list
  1093       $list  = $web.Lis ts.TryGetL ist($ListN ame)
  1094    
  1095       if($Li st -ne $nu ll)
  1096       {
  1097           #G et the col umn
  1098           $l ist.Fields  | ? {$_.T itle -matc h $ColumnN ame} | % {
  1099                #Reset c olumn prop erties to  allow dele te
  1100                #$_.Hidd en = $Fals e
  1101                $_.ReadO nlyField =  $False
  1102                $_.Allow Deletion =  $True
  1103                $_.Updat e()
  1104                #Delete  the column  from list
  1105                $list.Fi elds.Delet e($_)
  1106                write-ho st ("Colum n " + $_.T itle + " h as been de leted!") - f Magenta
  1107           }
  1108       }
  1109       else
  1110       {
  1111           wr ite-host " Specified  List is no t found!"  -Foregroun dColor Yel low
  1112       }
  1113   }
  1114  
  1115   function S et-SiteCol umnLookup  ($colName, $colStatic Name, $loo kupListNam e,$lookupC olumnName)  {
  1116       $web =  Get-SiteW eb
  1117       $looku pList = $w eb.Lists[$ lookupList Name]  
  1118       $web.F ields.AddL ookup($col StaticName , $lookupL ist.ID,$fa lse);
  1119       $field  = $web.Fi elds[$colS taticName]
  1120       $field .LookupFie ld = $look upColumnNa me
  1121       $field .Title = $ colName
  1122       $field .Update()
  1123   }
  1124  
  1125   function S et-Facilit yListPermi ssionAndVe rsioning ( $listTitle ,[Microsof t.SharePoi nt.SPMembe r]$securit yMember,[M icrosoft.S harePoint. SPRights]$ permission Mask, [swi tch] $enab leVersioni ng) {
  1126       (Get-S iteWeb).we bs | % {
  1127           $l istPerm =  $_.Lists[$ listTitle]
  1128           $l istPerm.Pe rmissions. Add($secur ityMember, $permissio nMask)
  1129           #v ersioning
  1130           if ($enableVe rsioning)  {
  1131                $listPer m.EnableVe rsioning =  $True             
  1132           }
  1133           $l istPerm.Up date()
  1134       }
  1135   }
  1136  
  1137   function I mport-RAMS Users ($in putFilePat h) {
  1138       $webur l = Get-Si teURL
  1139       $webSi te = Get-S iteWeb
  1140  
  1141       $userL ist = impo rt-csv -Pa th $inputF ilePath -D elimiter " ," | Selec t-Object - Property " Security G roup", Per son
  1142  
  1143       $userL ist | % {     
  1144           $g roup = $_. "Security  Group"
  1145           $p erson = $_ .Person
  1146           $u serGroup =  $webSite. SiteGroups  | ? {$_.N ame -eq ($ group)}
  1147           $m atchUser =  $webSite. SiteUsers  | ? {$_.Di splayName  -eq $perso n}
  1148           if ($matchUse r) {
  1149                $matchUs er | % {
  1150                    $use rGroup.Add User($_)
  1151                    Writ e-Host "$( $matchUser .DisplayNa me) has be en added t o Security  Group: $( $userGroup .Name)" -F oregroundC olor Cyan
  1152                }
  1153           }
  1154       }
  1155   }
  1156   #region Ca lendar rel ated funct ions for R AMS
  1157   function N ew-Meeting MinuteLook up ([Param eter (Mand atory=$Tru e)][Micros oft.ShareP oint.SPWeb ]$web, [Pa rameter (M andatory=$ True)][str ing]$commi ttee) {
  1158       # GET  THE SITE
  1159       #$web  = Get-SPWe b $siteURL     
  1160  
  1161       #CREAT E SITE COL UMNS
  1162       echo " CREATING M eetingMinu teLookup S ITE COLUMN S"
  1163       
  1164       $calen darName=$c ommittee +  " Calenda r"
  1165           #  GET THE LI STS
  1166           $m yList = $w eb.Lists[$ calendarNa me];
  1167  
  1168           #W here the S ource List  for Looku p Exists
  1169           
  1170           $P arentWebUR L=$web.Url
  1171           
  1172       $Paren tListName= $committee  + " Docum ents"
  1173           $P arentLooku pColumnNam e="Title"
  1174           
  1175           #W here the L ookup Site  column Go ing to get  created
  1176           $C hildWebURL =$web.Url
  1177           
  1178       $Child LookupColu mnName= $c ommittee +  "MeetingM inuteLooku p"
  1179  
  1180           #G et the Par ent and Ch ild Webs a nd ListQ
  1181           
  1182           $P arentWeb =  Get-SPWeb  $ParentWe bURL
  1183           $P arentList  = $ParentW eb.Lists[$ ParentList Name]
  1184           $C hildWeb =  Get-SPWeb  $ChildWebU RL
  1185           
  1186           if (!$ChildWe b.Fields.C ontainsFie ld($ChildL ookupColum nName))
  1187           
  1188           {
  1189                #Add Loo kup Field
  1190           
  1191                $ChildLo okupColumn  = $ChildW eb.Fields. AddLookup( $ChildLook upColumnNa me,$Parent List.id,$F alse)
  1192           
  1193                $ChildLo okupColumn  = $ChildW eb.Fields[ $ChildLook upColumnNa me]
  1194           
  1195                #Setup l ookup Fiel d property
  1196           
  1197                $ChildLo okupColumn .LookupWeb Id = $Pare ntWeb.ID
  1198           
  1199                $ChildLo okupColumn .LookupFie ld = $Pare ntList.Fie lds[$Paren tLookupCol umnName].I nternalNam e
  1200           
  1201                $ChildLo okupColumn .AllowMult ipleValues =$true
  1202           
  1203                    $Chi ldLookupCo lumn.Group ="RAMS IRB
  1204           $C hildLookup Column.Tit le=$commit tee + " Me eting Minu te Lookup"
  1205  
  1206                $ChildLo okupColumn .update() 
  1207  
  1208           wr ite-host " Lookup fie ld added s uccessfull y to the s ite!" -f g reen
  1209           }
  1210           el se
  1211           {
  1212          wri te-host "F ield Exist s already  on the web !" -f gree n
  1213          $Ch ildLookupC olumn = $C hildWeb.Fi elds.TryGe tFieldBySt aticName($ ChildLooku pColumnNam e)
  1214          #Ad d column t o the Cale ndar List,  if missin g
  1215           if ($myList.F ields.Cont ainsFieldW ithStaticN ame($Child LookupColu mnName) -e q $False)
  1216           {     
  1217                    $myL ist.Fields .Add($Chil dLookupCol umn)
  1218                    $myL ist.Update ()
  1219                    writ e-host "Lo okup field  added suc cessfully  to the Cal endar List !" -f gree n
  1220           }
  1221           
  1222           } 
  1223  
  1224   }
  1225  
  1226   function U pdate-Cale ndarView([ Parameter  (Mandatory =$True)][M icrosoft.S harePoint. SPWeb]$web , [Paramet er (Mandat ory=$True) ][string]$ committee)  
  1227   {
  1228    
  1229       $list  = $web.Lis ts.TryGetL ist("$comm ittee Cale ndar")
  1230       if($li st -ne $nu ll)
  1231       {
  1232         #UPD ATE THE VI EW
  1233         echo  "UPDATING  THE VIEW"
  1234         $vie w = $list. Views | ?  { $_.Title  -eq 'All  Events' };
  1235           
  1236                if( $vie w.ViewFiel ds.exists( "Location" )){
  1237                    $vie w.ViewFiel ds.Delete( "Location" );
  1238           }
  1239  
  1240        
  1241          if(  $view.Vie wFields.ex ists("Even tDate")){
  1242           $v iew.ViewFi elds.Delet e("EventDa te");
  1243          }
  1244  
  1245              if( $view. ViewFields .exists("E ndDate")){
  1246           $v iew.ViewFi elds.Delet e("EndDate ");
  1247          }
  1248          
  1249          if(  $view.Vie wFields.ex ists("fAll DayEvent") ){
  1250           $v iew.ViewFi elds.Delet e("fAllDay Event");
  1251          
  1252          }
  1253  
  1254               #Create c ustomized  view
  1255               if( !$vie w.ViewFiel ds.exists( "EventDate ")){
  1256           $v iew.ViewFi elds.Add(" EventDate" ); 
  1257          }
  1258          
  1259               if( !$vie w.ViewFiel ds.exists( "EndDate") ){
  1260           $v iew.ViewFi elds.Add(" EndDate");  
  1261          }
  1262          
  1263         if(  !$view.Vie wFields.ex ists("Loca tion")){
  1264           $v iew.ViewFi elds.Add(" Location")
  1265          }
  1266           
  1267              if( !$view .ViewField s.exists(" EventAtten dees")){
  1268           $v iew.ViewFi elds.Add(" EventAtten dees"); 
  1269          }
  1270          
  1271          if(  !$view.Vi ewFields.e xists("Com mittee Att endees")){
  1272           $v iew.ViewFi elds.Add(" Committee  Attendees" ); 
  1273          }
  1274     
  1275           $v iew.Defaul tView = $t rue
  1276           $v iew.Update ()
  1277  
  1278           if ($list -ne  $null)
  1279           {
  1280        
  1281                $content Type = "Ev ent"
  1282                $newFiel dOrder = @ ("Title",  "EventDate ", "EndDat e", "Locat ion", "fAl lDayEvent" , "fRecurr ence","Eve ntAttendee s", "Event CommitteeA ttendees",   "Partici pantsPicke r","Admini strative_x 0020_Items ", "TaxKey word", "Su bmittedApp licationLo okup", "$( $committee )MeetingMi nuteLookup ", "Decisi on", 
  1283                "Deliber ation"
  1284                )
  1285               if ($list .Fields.Co ntainsFiel d("Descrip tion")) {
  1286                         $ct = $lis t.ContentT ypes[$cont entType] 
  1287                         $ct.FieldL inks["Desc ription"]. Hidden = $ True
  1288                         $ct.FieldL inks.Reord er($newFie ldOrder)
  1289                         $ct.Update () 
  1290                         $list.Upda te()
  1291               }
  1292  
  1293              if ($list. Fields.Con tainsField ("Category ")) {
  1294                         $categoryf ield=$list .Fields["C ategory"]
  1295                         $categoryf ield.ShowI nNewForm=$ false 
  1296                         $categoryf ield.ShowI nEditForm= $false
  1297                         $categoryf ield.Updat e($true)
  1298                         $list.Upda te()
  1299            }
  1300          
  1301              if ($list. Fields.Con tainsField ("Applicat ionsLookup ")) {
  1302                    $app licationsF ield=$list .Fields["A pplication sLookup"]
  1303                $applica tionsField .ShowInNew Form=$fals
  1304                $applica tionsField .ShowInEdi tForm=$fal se
  1305                $applica tionsField .Update($t rue)
  1306                $list.Up date()
  1307              }
  1308             
  1309              if ($list. Fields.Con tainsField ("RDCMinut eLookup"))  {
  1310                $approve dRDCApplic ationLooku p=$list.Fi elds["RDCM inuteLooku p"]
  1311                $approve dRDCApplic ationLooku p.ShowInNe wForm=$fal se 
  1312                $approve dRDCApplic ationLooku p.ShowInEd itForm=$fa lse
  1313                $approve dRDCApplic ationLooku p.Update($ true)
  1314                $list.Up date()
  1315              }
  1316  
  1317              if ($list. Fields.Con tainsField ("Approved  Applicati on Lookup" )) {
  1318                    $app licationsF ield=$list .Fields["A pproved Ap plication  Lookup"]
  1319                $applica tionsField .ShowInNew Form=$fals
  1320                $applica tionsField .ShowInEdi tForm=$fal se
  1321                $applica tionsField .Update($t rue)
  1322                $list.Up date()
  1323              }
  1324  
  1325            i f ($list.F ields.Cont ainsField( "Attendees ")) {
  1326                    $app licationsF ield=$list .Fields["A ttendees"]
  1327                $applica tionsField .ShowInNew Form=$fals
  1328                $applica tionsField .ShowInEdi tForm=$fal se
  1329                $applica tionsField .Update($t rue)
  1330                $list.Up date()
  1331              }
  1332  
  1333            i f ($list.F ields.Cont ainsField( "Administr ative Item s")) {
  1334                    $app licationsF ield=$list .Fields["A dministrat ive Items" ]
  1335                $applica tionsField .ShowInNew Form=$fals
  1336                $applica tionsField .ShowInEdi tForm=$fal se
  1337                $applica tionsField .Update($t rue)
  1338                $list.Up date()
  1339              }
  1340           }        
  1341  
  1342       }   
  1343   }  
  1344   #endregion
  1345  
  1346   function N ew-SPList  ([Paramete r (Mandato ry=$True)] [Microsoft .SharePoin t.SPWeb]$w eb, [Param eter (Mand atory=$Tru e)][string ]$newCommi teeName,[P arameter ( Mandatory= $True)][Va lidateSet( "Documents ", "Calend ar", "Form  Library") ][string]$ templateNa me ) {
  1347       
  1348       if($te mplateName  -eq "Docu ments") {
  1349           $t emplate =  $website.L istTemplat es["Docume nt Library "]
  1350       }
  1351       else {
  1352           $t emplate =  $website.L istTemplat es["$templ ateName"]
  1353       }
  1354       
  1355          
  1356  
  1357       #add n ew list
  1358       if(($f acilitySit e.Lists.Tr yGetList(" $($newComm iteeName)$ templateNa me")) -eq  $Null) {
  1359           $f acilitySit e.Lists.Ad d("$($newC ommiteeNam e)$templat eName","$( $newCommit eeName) $t emplateNam e",$templa te)    
  1360       }
  1361       $newSP List = $fa cilitySite .Lists.Try GetList("$ ($newCommi teeName)$t emplateNam e")
  1362                  
  1363       #chang e title
  1364       $newSP List.Title ="$($newCo mmiteeName ) $templat eName";
  1365           
  1366       #enabl e versioni ng
  1367       $newSP List.Enabl eVersionin g = $True;         
  1368           
  1369       #updat e calendar
  1370       $newSP List.Updat e() 
  1371  
  1372       #retur n
  1373       return  $newSPLis t
  1374   }
  1375  
  1376   Export-Mod uleMember  -function  Get-SiteUR
  1377   Export-Mod uleMember  -function  Get-SiteWe
  1378   Export-Mod uleMember  -function  Set-SiteCo lumn -Alia s Add-Site Column, as c
  1379   Export-Mod uleMember  -function  Add-SiteCo lumnToCT - Alias ascc t
  1380  
  1381   Export-Mod uleMember  -function  Add-Facili tyWorkflow  -Alias af wf
  1382   Export-Mod uleMember  -function  Add-SiteCo llectionWo rkFlow
  1383   Export-Mod uleMember  -function  Get-DateFr omDays
  1384   Export-Mod uleMember  -function  Format-Lis tOutput
  1385   Export-Mod uleMember  -function  Get-ListIn ternalName
  1386   Export-Mod uleMember  -function  Get-SPList
  1387   Export-Mod uleMember  -function  Remove-Dat aFromAList
  1388   Export-Mod uleMember  -function  Deploy-Fea ture
  1389   Export-Mod uleMember  -function  Update-Uti lMF
  1390   Export-Mod uleMember  -function  Get-RAMSEn v
  1391   Export-Mod uleMember  -function  New-RAMSEn v
  1392   Export-Mod uleMember  -function  Update-RAM SEnv
  1393   Export-Mod uleMember  -function  Get-RAMSSh arePointIn stallInfo
  1394   Export-Mod uleMember  -function  Get-Facili tySites
  1395   Export-Mod uleMember  -function  New-RAMSGr oup -Alias  nrg
  1396   Export-Mod uleMember  -function  Add-Facili tyGroup -A lias afg
  1397   Export-Mod uleMember  -Function  RunSQL-Ret urnInt -Al ias rsri
  1398   Export-Mod uleMember  -Function  RunSQL-Ret urnDR -Ali as rsrdr
  1399   Export-Mod uleMember  -Function  Remove-Wor kFlow -Ali as remwf
  1400   Export-Mod uleMember  -Function  Rename-Lis t -Alias r enList
  1401   Export-Mod uleMember  -Function  Clone-Cale ndar -Alia s cloneCal
  1402   Export-Mod uleMember  -Function  Remove-Cal endarColum ns -Alias  RCC
  1403  
  1404   Export-Mod uleMember  -Function  Remove-Fac ilitySiteP ages 
  1405   Export-Mod uleMember  -Function  Remove-Fac ilitySiteA ssets 
  1406  
  1407   #added on  03/16/2018
  1408   Export-Mod uleMember  -Function  New-SpList View
  1409   Export-Mod uleMember  -Function  Update-SpL istView
  1410  
  1411   #added on  03/17/2018
  1412   Export-Mod uleMember  -function  Remove-Con tentTypeFr omList 
  1413   #Export-Mo duleMember  -function  Set-SiteC olumnLooku p
  1414   Export-Mod uleMember  -function  Add-SiteCo lumnToCTBy Title
  1415  
  1416   #added on  03/19/2018
  1417   Export-Mod uleMember  -function  Remove-Col umnFromLis t
  1418  
  1419   #added on  04/10/2018
  1420   Export-Mod uleMember  -function  Set-SiteCo lumnLookup
  1421  
  1422   #added on  04/13/2018
  1423   Export-Mod uleMember  -function  Update-Sit eColumnLoo kup
  1424  
  1425   #added on  4/15/2018
  1426   Export-Mod uleMember  -Function  Remove-Sit ePages 
  1427   Export-Mod uleMember  -Function  Remove-Sit eAssets 
  1428  
  1429   #added on  5/01/2018
  1430   Export-Mod uleMember  -Function  Set-Facili tyListPerm issionAndV ersioning
  1431  
  1432   #added on  5/07/2018
  1433   Export-Mod uleMember  -Function  Import-RAM SUsers
  1434  
  1435   #added on  5/10/2018
  1436   Export-Mod uleMember  -Function  New-Meetin gMinuteLoo kup
  1437   Export-Mod uleMember  -Function  Update-Cal endarView
  1438   Export-Mod uleMember  -Function  New-SPList
  1439  
  1440  
  1441   <#
  1442   $PSModuleA utoLoading Preference
  1443   Remove-Mod ule -Name  RAMS_Modul e_Util
  1444   Import-Mod ule .\modu le\RAMS_Mo dule_Util. psm1
  1445   New-RAMSEn v
  1446   Update-RAM SEnv
  1447  
  1448   Set-Locati on .\Utili tyScripts
  1449   Set-Locati on .\modul e
  1450   New-Module Manifest - Path .\RAM S_Module_U til.psd1 - ModuleVers ion 1.1.0  -Author "C hita Nilak , ByLight"  -RootModu le .\RAMS_ Module_Uti l.psm1 -De scription  "RAMS Util ity Functi ons" -Comp anyName "V A.GOV.RAMS " -Verbose  
  1451  
  1452   if((Get-Mo dule -Name  RAMS_Modu le_Util) - ne $null)  {
  1453       Remove -Module -N ame RAMS_M odule_Util
  1454   }
  1455   try {
  1456       Import -Module .\ RAMS_Modul e_Util.psd
  1457   }
  1458   catch {
  1459       Write- Host Host:  $env:COMP UTERNAME i s not a Se rver, Shar ePoint is  not instal led on thi s computer ...ignore,  informati on only.
  1460       #do no thing.
  1461   }
  1462   clear
  1463   #>
  1464  
  1465