Tags » PowerShell

Copy Files from SharePoint Library Folder to Another SharePoint Library Folder

$varSourceWebUrl="http://team/sites/teamsite1"
$varTargetWebUrl="http://team/sites/teamsite2"
$varSourceLibraryName = "Shared Documents"
$varTargetLibraryName = "Shared Documents"
$varSourceFolderUrl = "http://team/sites/teamsite1/Shared Documents/Subfolder/"
$varTargetParentFolderUrl = "http://team/sites/teamsite2/Shared Documents"

 $varSourceWeb = Get-SPWeb $varSourceWebUrl
 $varTargetWeb = Get-SPWeb $varTargetWebUrl 
 $varSourceLibrary = $varSourceWeb.Lists[$varSourceLibraryName]
 $varTargetLibrary = $varTargetWeb.Lists[$varTargetLibraryName]
 $varSourceFolder = $varSourceWeb.GetFolder($varSourceFolderUrl) 
 $varTargetFolder = $varTargetWeb.GetFolder($varTargetFolderUrl)
 $varTargetFolderParent = $varTargetWeb.GetFolder($varTargetParentFolderUrl)
 $varTargetFolderName =$varTargetFolder.Name
 if(!$varTargetFolder.Exists)
 {
 $varTargetFolder = $varTargetLibrary.AddItem($varTargetFolderParent,::Folder,$varTargetFolderName)
 $varTargetFolder.Update()
 }
 $varSourceFolder = $varSourceWeb.GetFolder($varSourceFolderUrl)
 $varTargetFolder = $varTargetWeb.GetFolder($varTargetFolderUrl)
 $colSourceFiles = $varSourceFolder.Files
 foreach ($varSourceFile in $colSourceFiles) 
 {
 $varTargetFileUrl = $varTargetFolder.ServerRelativeUrl + "/" + $varSourceFile.Name
 $varTargetFile=$varTargetWeb.GetFile($varTargetFileUrl)
 if(!$varTargetFile.Exists)
 {
 $varBuffer = $varSourceFile.OpenBinary();
 $varNewTargetFile = $varTargetFolder.Files.Add($varTargetFile,$varBuffer,$true)
 }
 }
 
$varSourceWeb.Dispose();
$varTargetWeb.Dispose();
PowerShell

SharePoint 2016: How to setup Development Environment for CSOM based PowerShell Development

Since the evolution of PowerShell Development framework that can be used in conjunction with CSOM API of SharePoint. This type of development could be relatively more useful in scenarios where we do not have direct access to SharePoint Server and only client machines are accessible. 198 more words

SharePoint 2013

Practical Use: Find & Replace in a Text File

A number of applications rely on simple text-based configuration files versus some proprietary format.  This makes editing files – ones that can’t simply be replaced via GPO/GPP or Login Script – really easy to update. 577 more words

PowerShell

Guideline For AWS (Amazon Web services)

As all we know AWS is cloud based computing and its gives us many web services.Now question for system administrator how to lean the concept and how many type certification are available for AWS. 139 more words

Powershell

Tip: Como especificar que un script requiera ejecutarse como administrador | PowerShell

Muchas veces es requerido que un script sea ejecutado con privilegios de administrador, por lo que es recomendado asegurarnos que el usuario lo ejecute de esa forma. 33 more words

Powershell

PowerSQL - Get SQL TraceFlag SQL Service and Config Information

Get SQL Server configuration, service info, start type along with enabled Trace Flags of local or remote servers.

This script outputs sql server configuration, service, start type, Service Account along with startup trace flags. 251 more words

SQL

Mail-enable already created distribution group.

Today I had an AD administrator create a distribution group and add all the members to it in Active Directory.  They needed it enabled in Exchange so I thought easy just go into the EAC (Exchange Administrative Center) and add an existing group.   60 more words

Powershell