188 lines
3.2 KiB
Markdown
188 lines
3.2 KiB
Markdown
![]() |
Powershell check Solution Version
|
|||
|
|
|||
|
Mittwoch, 2. September 2020
|
|||
|
|
|||
|
10:24
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\# Creator Ralf Koop
|
|||
|
|
|||
|
\# Created 01.09.2020
|
|||
|
|
|||
|
\# Last Update 01.09.2020
|
|||
|
|
|||
|
\# Version 1
|
|||
|
|
|||
|
\# als Webapplication muss \"nur\" der erste Teil der Url angegeben werden ohne Protokoll
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\$url = Read-host \"Bitte Webapplication angeben \"
|
|||
|
|
|||
|
\$appurl = \"<https://$url.bkk-mobiloil.de>\"
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\$ErrorActionprefence = \"SilentyContinue\"
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\$webapp = Get-SPWebApplication \$appurl
|
|||
|
|
|||
|
#\$allroot = \$webapp \|get-spsite -Limit all \|get-spweb -Limit all \|where {\$\_.isrootweb -eq \"true\"}
|
|||
|
|
|||
|
\$allroot = (\$webapp \|get-spsite -Limit all).rootweb
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\# Löschen der SiteCollection aus der Variablen, die die Solution nicht bekommen sollen
|
|||
|
|
|||
|
if (\$url =\"mobilnet\") {
|
|||
|
|
|||
|
\$allroot = \$allroot \|where {\$\_.url -ne \"<https://kerbmobilnet.bkk-mobiloil.de/sites/WizdomData>\"}
|
|||
|
|
|||
|
\$allroot = \$allroot \|where {\$\_.url -ne \"<https://kerbmobilnet.bkk-mobiloil.de/sites/testrkowizdom>\"}
|
|||
|
|
|||
|
\$allroot = \$allroot \|where {\$\_.url -ne \"<https://kerbmobilnet.bkk-mobiloil.de/internal/cth>\"}
|
|||
|
|
|||
|
\$allroot = \$allroot \|where {\$\_.url -ne \"<https://kerbmobilnet.bkk-mobiloil.de/sites/akp>\"}
|
|||
|
|
|||
|
\$allroot = \$allroot \|where {\$\_.url -ne \"<https://kerbmobilnet.bkk-mobiloil.de/sites/cth>\"}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\$i = 0
|
|||
|
|
|||
|
foreach (\$rootweb in \$allroot)
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
\$ergebnis = \"\"
|
|||
|
|
|||
|
\$test = \"\"
|
|||
|
|
|||
|
\$test2 = \"\"
|
|||
|
|
|||
|
\$i++
|
|||
|
|
|||
|
\$web = Get-SPWeb \$rootweb.url
|
|||
|
|
|||
|
\$List = \$web.Lists\[\"Formatbibliothek\"\]
|
|||
|
|
|||
|
\$item = \$List.Items \|where {\$\_.url -like \"\*intranet\*\" -AND \$\_.Name -like \"Change\*\"}
|
|||
|
|
|||
|
\$file = \$item.File
|
|||
|
|
|||
|
\$data = \$file.OpenBinary()
|
|||
|
|
|||
|
\$encode = New-Object System.text.asciiencoding
|
|||
|
|
|||
|
\$test = \$encode.GetString(\$data)
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\$test2 = \$test.Split(\[Environment\]::NewLine)
|
|||
|
|
|||
|
\$pattern = \'\[0-9\]\[.\]\[0-9\]\[.\]\[0-9\]\[.\]\[0-9\]\'
|
|||
|
|
|||
|
\$ergebnis = \[regex\]::Matches(\$test2, \$pattern).value\|select -last 2
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Write-host \$i von \$allroot.count
|
|||
|
|
|||
|
Write-host \$web.url
|
|||
|
|
|||
|
\$ergebnis
|
|||
|
|
|||
|
#\$test.Split(\[Environment\]::NewLine) \|select -Last 4
|
|||
|
|
|||
|
Write-host
|
|||
|
|
|||
|
Write-host
|
|||
|
|
|||
|
Write-host
|
|||
|
|
|||
|
\# Creator Ralf Koop
|
|||
|
|
|||
|
\# Created 01.09.2020
|
|||
|
|
|||
|
\# Last Update 01.09.2020
|
|||
|
|
|||
|
\# Version 1
|
|||
|
|
|||
|
\# als Webapplication muss \"nur\" der erste Teil der Url angegeben werden ohne Protokoll
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\$url = Read-host \"Bitte Webapplication angeben \"
|
|||
|
|
|||
|
\$appurl = \"<https://$url.bkk-mobiloil.de>\"
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\$ErrorActionprefence = \"SilentyContinue\"
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\$webapp = Get-SPWebApplication \$url
|
|||
|
|
|||
|
#\$allroot = \$webapp \|get-spsite -Limit all \|get-spweb -Limit all \|where {\$\_.isrootweb -eq \"true\"}
|
|||
|
|
|||
|
\$allroot = (\$webapp \|get-spsite -Limit all).rootweb
|
|||
|
|
|||
|
\$i = 0
|
|||
|
|
|||
|
foreach (\$rootweb in \$allroot)
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
\$i++
|
|||
|
|
|||
|
\$web = Get-SPWeb \$rootweb.url
|
|||
|
|
|||
|
\$List = \$web.Lists\[\"Formatbibliothek\"\]
|
|||
|
|
|||
|
\$item = \$List.Items \|where {\$\_.url -like \"\*webparts\*\" -AND \$\_.Name -like \"Change\*\"}
|
|||
|
|
|||
|
\$file = \$item.File
|
|||
|
|
|||
|
\$data = \$file.OpenBinary()
|
|||
|
|
|||
|
\$encode = New-Object System.text.asciiencoding
|
|||
|
|
|||
|
\$test = \$encode.GetString(\$data)
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\$test2 = \$test.Split(\[Environment\]::NewLine)
|
|||
|
|
|||
|
\$pattern = \'\[0-9\]\[.\]\[0-9\]\[.\]\[0-9\]\[.\]\[0-9\]\'
|
|||
|
|
|||
|
\$ergebnis = \[regex\]::Matches(\$test2, \$pattern).value\|select -last 2
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Write-host \$i von \$allroot.count
|
|||
|
|
|||
|
Write-host \$web.url
|
|||
|
|
|||
|
\$ergebnis
|
|||
|
|
|||
|
#\$test.Split(\[Environment\]::NewLine) \|select -Last 2
|
|||
|
|
|||
|
Write-host
|
|||
|
|
|||
|
Write-host
|
|||
|
|
|||
|
Write-host
|