54 lines
908 B
PowerShell
54 lines
908 B
PowerShell
param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$url
|
|
)
|
|
|
|
function Write-Log($msg)
|
|
{
|
|
Write-Host $msg -foregroundcolor green
|
|
($msg) | Out-File "log.txt" -Append
|
|
}
|
|
|
|
function Get-List($lists, $title)
|
|
{
|
|
foreach ($list in $lists)
|
|
{
|
|
if ($list.Title -eq $title)
|
|
{
|
|
return $list
|
|
}
|
|
}
|
|
return $null
|
|
}
|
|
|
|
function Sync-List($web, $list)
|
|
{
|
|
foreach ($item in $list.Items)
|
|
{
|
|
Write-Log (" " + $item["Taloyhtiön nimi"])
|
|
$item.Update()
|
|
Start-Sleep -Seconds 3
|
|
}
|
|
}
|
|
|
|
|
|
function Sync-Pmc($site)
|
|
{
|
|
$web = $site.RootWeb
|
|
Write-Log ($web.Url)
|
|
$list = Get-List $web.Lists "Sivustot"
|
|
if ($list -eq $null)
|
|
{
|
|
Write-Log ("WARNING: Sivustot list not found")
|
|
return
|
|
}
|
|
Sync-List $web $list
|
|
}
|
|
|
|
$wa = Get-SPWebApplication $url
|
|
foreach ($site in $wa.Sites)
|
|
{
|
|
Sync-Pmc $site
|
|
}
|
|
#$site = Get-SPSite $url
|
|
#Sync-Pmc $site |