Moss

SharePoint Powershell to backup web.config with date time stamp

param( [string] $fileName) $location=$filename-replace “web.config$”,”” if (-not(Test-Path $fileName)) {break} “Original filename: $fileName” $fileObj = get-item $fileName $DateStamp = get-date -uformat “%Y-%m-%d@%H-%M-%S” $extOnly = $fileObj.extension if ($extOnly.length -eq 0) { $nameOnly = $fileObj.Name $con=”._copy” copy “$fileObj” “$fileObj$con” rename-item “$fileObj$con” “$location$nameOnly-$DateStamp” }…