Skip to content

Commit 1173073

Browse files
author
Pollinger
committed
Update for 0.3.0
New features and maintenance scripts
1 parent f01b04f commit 1173073

9 files changed

Lines changed: 254 additions & 7 deletions
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Function Disconnect-MSPage {
2+
<#
3+
.SYNOPSIS
4+
Disconnecting Pages
5+
.DESCRIPTION
6+
... {DESCRIPTION} ...
7+
.EXAMPLE
8+
... {EXAMPLE} ...
9+
.INPUTS
10+
... {INPUTS} ...
11+
.OUTPUTS
12+
... {OUTPUTS} ...
13+
.LINK
14+
... {LINK} ...
15+
.NOTES
16+
... {NOTES} ...
17+
#>
18+
[Alias('Disconnect-CMSPage')]
19+
[CmdletBinding(DefaultParameterSetName = 'byMSSession')]
20+
param(
21+
# {DESCRIPTION}
22+
[Parameter(
23+
Position = 0,
24+
Mandatory = $true,
25+
ParameterSetName = 'byMSSession'
26+
)]
27+
[string] $PageGUID,
28+
# {DESCRIPTION}
29+
[Parameter(
30+
Position = 1,
31+
Mandatory = $true,
32+
ParameterSetName = 'byMSSession'
33+
)]
34+
[string] $LinkGUID
35+
)
36+
begin {
37+
Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand);
38+
}
39+
process {
40+
Write-Debug -Message ("[ Process => function {0} ]" -f $MyInvocation.MyCommand);
41+
Set-MSTimestamp;
42+
$Request = ("<IODATA loginguid='[!guid_login!]' sessionkey='[!key!]' dialoglanguageid='[!dialog_language_id!]'><LINK action='save' guid='[!guid_link!]'><PAGES><PAGE deleted='1' guid='[!guid_page!]' /></PAGES></LINK></IODATA>").Replace("[!guid_page!]", $PageGUID).Replace("[!guid_link!]", $LinkGUID);
43+
$Request = Import-MSSessionProperties -Request ($Request);
44+
[xml]$Response = Invoke-MSRQLRequest -Request ($Request);
45+
Show-MSSessionWebServiceDebug;
46+
return $Response;
47+
}
48+
end {
49+
Write-Debug -Message ("[ Leave => function {0} ]" -f $MyInvocation.MyCommand);
50+
}
51+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Function Get-MSPageLinkingAppearanceSchedules {
2+
<#
3+
.SYNOPSIS
4+
Disconnecting Pages
5+
.DESCRIPTION
6+
... {DESCRIPTION} ...
7+
.EXAMPLE
8+
... {EXAMPLE} ...
9+
.INPUTS
10+
... {INPUTS} ...
11+
.OUTPUTS
12+
... {OUTPUTS} ...
13+
.LINK
14+
... {LINK} ...
15+
.NOTES
16+
... {NOTES} ...
17+
#>
18+
[Alias('Get-CMSPageLinkingAppearanceSchedules')]
19+
[CmdletBinding(DefaultParameterSetName = 'byMSSession')]
20+
param(
21+
# {DESCRIPTION}
22+
[Parameter(
23+
Position = 0,
24+
Mandatory = $true,
25+
ParameterSetName = 'byMSSession'
26+
)]
27+
[string] $PageGUID
28+
)
29+
begin {
30+
Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand);
31+
}
32+
process {
33+
Write-Debug -Message ("[ Process => function {0} ]" -f $MyInvocation.MyCommand);
34+
Set-MSTimestamp;
35+
$Request = ("<IODATA loginguid='[!guid_login!]' sessionkey='[!key!]' dialoglanguageid='[!dialog_language_id!]'><PAGE guid='[!guid_page!]'><LINKSFROM action='load'/></PAGE></IODATA>").Replace("[!guid_page!]", $PageGUID);
36+
$Request = Import-MSSessionProperties -Request ($Request);
37+
[xml]$Response = Invoke-MSRQLRequest -Request ($Request);
38+
Show-MSSessionWebServiceDebug;
39+
return $Response;
40+
}
41+
end {
42+
Write-Debug -Message ("[ Leave => function {0} ]" -f $MyInvocation.MyCommand);
43+
}
44+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
Function Find-MSPagesLinkingSchedule {
2+
<#
3+
.SYNOPSIS
4+
(Extended) Page Search > Content Class
5+
.DESCRIPTION
6+
You can use this RQL to search for searching pages based on their linking and appearance schedule.
7+
.EXAMPLE
8+
... {EXAMPLE} ...
9+
.INPUTS
10+
... {INPUTS} ...
11+
.OUTPUTS
12+
... {OUTPUTS} ...
13+
.LINK
14+
... {LINK} ...
15+
.NOTES
16+
RQL: (Extended) Page Search, Software version >= 7.5
17+
History:
18+
16.0 SP2 Added the SEARCHITEM of type element. Added the SEARCHITEM of type linkingschedule.
19+
11.0.0 Added description for searchguid attribute of the xsearch request in order to implement result paging.
20+
#>
21+
[Alias('Find-CMSPagesLinkingSchedule')]
22+
[CmdletBinding(DefaultParameterSetName = 'byMSSession')]
23+
param(
24+
# {DESCRIPTION}
25+
[Parameter(
26+
Position = 0,
27+
Mandatory = $true,
28+
ParameterSetName = 'byMSSession'
29+
)]
30+
[datetime] $LinkingScheduleDate,
31+
# {DESCRIPTION}
32+
[Parameter(
33+
Position = 1,
34+
Mandatory = $false,
35+
ParameterSetName = 'byMSSession'
36+
)]
37+
[string] $SearchGUID,
38+
# {DESCRIPTION}
39+
[Parameter(
40+
Position = 2,
41+
Mandatory = $false,
42+
ParameterSetName = 'byMSSession'
43+
)]
44+
[int] $Page = 1,
45+
# {DESCRIPTION}
46+
[Parameter(
47+
Position = 3,
48+
Mandatory = $false,
49+
ParameterSetName = 'byMSSession'
50+
)]
51+
[int] $PageSize = 10,
52+
# {DESCRIPTION}
53+
[Parameter(
54+
Position = 4,
55+
Mandatory = $false,
56+
ParameterSetName = 'byMSSession'
57+
)]
58+
[int] $MaxHits = 100
59+
)
60+
begin {
61+
Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand);
62+
}
63+
process {
64+
Write-Debug -Message ("[ Process => function {0} ]" -f $MyInvocation.MyCommand);
65+
Set-MSTimestamp;
66+
$Request = ("<IODATA loginguid='[!guid_Login!]' sessionkey='[!key!]' dialoglanguageid='[!dialog_language_id!]'><PAGE action='xsearch' orderby='pageid' orderdirection='ASC' searchguid='[!page_searchguid!]' page='[!page!]' pagesize='[!pagesize!]' maxhits='[!maxhits!]'><SEARCHITEMS><SEARCHITEM key='linkingschedule' value='inactive' operator='eq' date='[!date!]' /><SEARCHITEM key='specialpages' value='linked' operator='eq' /></SEARCHITEMS></PAGE></IODATA>").Replace("[!date!]", (ConvertTo-OADate -Date ($LinkingScheduleDate))).Replace("[!pagesize!]", $PageSize).Replace("[!maxhits!]", $MaxHits);
67+
if ($Page -and $SearchGUID) {
68+
$Request = $Request.Replace("[!page_searchguid!]", $SearchGUID).Replace("[!page!]", $Page);
69+
}
70+
else {
71+
$Request = $Request.Replace(" searchguid='[!page_searchguid!]'", "").Replace(" page='[!page!]'", "");
72+
}
73+
$Request = Import-MSSessionProperties -Request ($Request);
74+
[xml]$Response = Invoke-MSRQLRequest -Request ($Request);
75+
Show-MSSessionWebServiceDebug;
76+
return $Response;
77+
}
78+
end {
79+
Write-Debug -Message ("[ Leave => function {0} ]" -f $MyInvocation.MyCommand);
80+
}
81+
}

Scripts/Maintenance/Get-AllContentClassesWithoutInstances.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ foreach ($ContentClassFolder in $AllProjectContentClassFolders) {
3131
}
3232
$Instances = (Find-MSContentClassInstances -ContentClassGUID ($ContentClass.guid) -PageSize (1000) -MaxHits (1000)).SelectNodes("IODATA/PAGES/PAGE");
3333
Write-Progress -Activity ("Working... checking content class folder: {0} ({1})." -f $ContentClassFolder.name, $AllContentClassesOfFolder.Count) -Status ("Please wait - check for instances at content class: {0}." -f $ContentClass.name);
34-
if ($Instances.Count -gt 750) {
34+
if ($Instances.Count -le 3) {
3535
$ResultObject.ContentClassInstances = $Instances.Count;
3636
$AmountContentClassWithoutInstances += $ResultObject;
3737
}
3838
}
3939
}
4040

4141
#$AmountContentClassWithoutInstances | Format-Table; # Optional - Output to console
42-
$AmountContentClassWithoutInstances | Out-File -FilePath ("C:\Temp\Result-AmountContentClassWithoutInstances-{0}.txt" -f $WSMProjectGUID) -Encoding ("utf8") -Force; # Optional - Output to file
42+
$AmountContentClassWithoutInstances | Out-File -FilePath ("C:\Temp\Result-AmountContentClassWithoutInstances-{0}-{1}.txt" -f $WSMProjectGUID, (Get-Date -Format ("yyyyMMdd-HHmmss"))) -Encoding ("utf8") -Force; # Optional - Output to file
4343

4444
#Show-MSSession; # Optional
4545
Exit-MSSession -UseDefaults ($true);

Scripts/Maintenance/Get-AllContentClassesWithoutProjectVariantAssignment.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ foreach ($ContentClassFolder in $AllProjectContentClassFolders) {
3939
if ($Results) {
4040
$MissingProjectVariant = @();
4141
foreach ($Result in $Results) {
42-
$MissingProjectVariant += ($AllProjectVariants | Where-Object {$_.guid -eq $Result}).name;
42+
$MissingProjectVariant += ($AllProjectVariants | Where-Object { $_.guid -eq $Result }).name;
4343
}
4444
$ResultObject.MissingProjectVariant = $MissingProjectVariant;
4545
$MissingProjectVariants += $ResultObject;
@@ -54,7 +54,7 @@ foreach ($ContentClassFolder in $AllProjectContentClassFolders) {
5454
}
5555

5656
#$MissingProjectVariants | Format-Table; # Optional - Output to console
57-
$MissingProjectVariants | Out-File -FilePath ("C:\Temp\Result-MissingProjectVariants-{0}.txt" -f $WSMProjectGUID) -Encoding ("utf8") -Force; # Optional - Output to file
57+
$MissingProjectVariants | Out-File -FilePath ("C:\Temp\Result-MissingProjectVariants-{0}-{1}.txt" -f $WSMProjectGUID, (Get-Date -Format ("yyyyMMdd-HHmmss"))) -Encoding ("utf8") -Force; # Optional - Output to file
5858

5959
#Show-MSSession; # Optional
6060
Exit-MSSession -UseDefaults ($true);

Scripts/Maintenance/Get-AllProjectPublicationPackagesWithoutReferences.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ foreach ($PublicationPackage in $AllProjectPublicatioNPackages) {
4545
Write-Progress -Activity ("Finished...") -PercentComplete ($ValuePercentComplete) -CurrentOperation ("{0}% complete" -f [math]::Round($ValuePercentComplete)) -Status ("Please wait - Sending output to console.");
4646

4747
#$PublicationPackagesNoReference; # Optional - Output to console
48-
$PublicationPackagesNoReference | Out-File -FilePath ("C:\Temp\Result-PublicationPackagesNoReference-{0}.txt" -f $WSMProjectGUID) -Encoding ("utf8") -Force; # Optional - Output to file
48+
$PublicationPackagesNoReference | Out-File -FilePath ("C:\Temp\Result-PublicationPackagesNoReference-{0}-{1}.txt" -f $WSMProjectGUID, (Get-Date -Format ("yyyyMMdd-HHmmss"))) -Encoding ("utf8") -Force; # Optional - Output to file
4949

5050
#Show-MSSession; # Optional
5151
Exit-MSSession -UseDefaults ($true);
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
Register-MSConfigStore;
2+
3+
Set-MSConfigDebugMode -Value ($false); # $true oder $false
4+
5+
Register-MSSession -UseDefaults ($true);
6+
Select-MSSession -UseDefaults ($true);
7+
Enter-MSSession -UseDefaults ($true);
8+
9+
# GUID des Projektes im Format 09dd6c35-ad5d-4905-ab0f-4fbc0a37f61c oder 09DD6C35AD5D4905AB0F4FBC0A37F61C
10+
#$WSMProjectGUID = ("072d6659-a806-425b-aca8-d29f37fd6e7d"); # Vodafone Internet
11+
#$WSMProjectGUID = ("6A89CD93325D42FD81A42FA836547016"); # Vodafone Internet - Fachhandel Online
12+
#$WSMProjectGUID = ("107CB9590FBB4C1AB7B8F7FE2449EE85"); # Vodafone Internet - Innovation Park
13+
#$WSMProjectGUID = ("8C681C01ECE44FC8B1FB45C4A7760501"); # Vodafone Intranet (AskVodafone)
14+
#$WSMProjectGUID = ("BA2A9869B57D4BA89E598F6B4B48F0B6"); # Vodafone Mobile
15+
#$WSMProjectGUID = ("771B99172E8B404794FA805EF961EF57"); # vodafone Applications - MobileApp
16+
#$WSMProjectGUID = ("8A300F4B74AA4D4CB5C54C2165FC56D1"); # Shared Components - Simplicity
17+
#$WSMProjectGUID = ("09754F11ECFB485E98AA72853155CB00"); # Shared Data - Tariff Details
18+
$WSMProjectGUID = ("7C503F8E943E4E6CACE63B2DEB82BBF4"); # Development - Defects and Testing
19+
20+
$Result = Enter-MSProject -ProjectGUID ($WSMProjectGUID);
21+
$ResultProject = ($Result).SelectNodes("IODATA/PROJECT");
22+
$ResultProject.name;
23+
24+
$Counter = 0;
25+
$CountTotal = 0;
26+
$Date = ("31.12.2018");
27+
28+
$DisconnectedPages = @();
29+
$SkippedPages = @();
30+
31+
$ValuePercentComplete = 0;
32+
Write-Progress -Activity ("Working...") -PercentComplete ($ValuePercentComplete) -CurrentOperation ("{0}% complete" -f [math]::Round($ValuePercentComplete)) -Status ("Please wait - collecting data.");
33+
$ExpiredPages = (Find-MSPagesLinkingSchedule -PageSize (2000) -MaxHits (2000) -LinkingScheduleDate (Get-Date -Date ($Date))).SelectNodes("IODATA/PAGES/PAGE");
34+
35+
$WorkingStep = (99 / $ExpiredPages.Count);
36+
$ValuePercentComplete = 1;
37+
Write-Progress -Activity ("Working...") -PercentComplete ($ValuePercentComplete) -CurrentOperation ("{0}% complete" -f [math]::Round($ValuePercentComplete)) -Status ("Please wait - Found {0} expired pages in project {1}" -f ($ExpiredPages.guid).Count, ($ResultProject.name));
38+
$CountTotal += $ExpiredPages.Count;
39+
40+
foreach ($ExpiredPage in $ExpiredPages) {
41+
$Counter++;
42+
Write-Progress -Activity ("Working... (Disconnected pages {0} | Skipped pages {1} | Found {2} expired pages in project: {3})" -f ($DisconnectedPages).Count, ($SkippedPages).Count, ($ExpiredPages.guid).Count, ($ResultProject.name)) -PercentComplete ($ValuePercentComplete) -CurrentOperation ("{0}% complete" -f [math]::Round($ValuePercentComplete)) -Status ("Please wait - ({1}) - check linking of page: {0}." -f $ExpiredPage.headline, $Counter);
43+
$CountLinking = (Get-MSPageLinkingAppearanceSchedules -PageGUID ($ExpiredPage.guid)).SelectNodes("IODATA/LINKSFROM/LINK");
44+
if ($CountLinking.Count -eq 1) {
45+
Write-Progress -Activity ("Working... (Disconnected pages {0} | Skipped pages {1} | Found {2} expired pages in project: {3})" -f ($DisconnectedPages).Count, ($SkippedPages).Count, ($ExpiredPages.guid).Count, ($ResultProject.name)) -PercentComplete ($ValuePercentComplete) -CurrentOperation ("{0}% complete" -f [math]::Round($ValuePercentComplete)) -Status ("Please wait - ({1}) - check linking of page: {0}." -f $ExpiredPage.headline, $Counter);
46+
$DisconnectedPages += $ExpiredPage;
47+
$Result = Disconnect-MSPage -PageGUID ($ExpiredPage.guid) -LinkGuid ($ExpiredPage.mainlink);
48+
}
49+
else {
50+
Write-Progress -Activity ("Working... (Disconnected pages {0} | Skipped pages {1} | Found {2} expired pages in project: {3})" -f ($DisconnectedPages).Count, ($SkippedPages).Count, ($ExpiredPages.guid).Count, ($ResultProject.name)) -PercentComplete ($ValuePercentComplete) -CurrentOperation ("{0}% complete" -f [math]::Round($ValuePercentComplete)) -Status ("Please wait - ({1}) - check linking of page: {0}." -f $ExpiredPage.headline, $Counter);
51+
#Write-Output ("GUID: {2} | Total: {0} | Expired: {1}" -f $CountLinking.Count, ($CountLinking | Where-Object { $_.dateend -ne "0" }).Count, $ExpiredPage.guid);
52+
#$CountLinking | Select-Object -Property "dateend" | Where-Object { $_.dateend -le (ConvertTo-OADate -Date (Get-Date -Date ($Date))) };
53+
$SkippedPages += $ExpiredPage;
54+
}
55+
$ValuePercentComplete += $WorkingStep;
56+
}
57+
58+
Write-Progress -Activity ("Finished...") -PercentComplete ($ValuePercentComplete) -CurrentOperation ("{0}% complete" -f [math]::Round($ValuePercentComplete)) -Status ("Please wait - Sending output to console.");
59+
60+
$DisconnectedPages.Count;
61+
$SkippedPages.Count;
62+
63+
#$DisconnectedPages | Select-Object -Property ("guid", "mainlink", "id", "headline") | Format-Table; # Optional
64+
$DisconnectedPages | Select-Object -Property ("guid", "mainlink", "id", "headline") | Format-Table | Out-File -FilePath ("C:\Temp\Result-RemovedExpiredPages-{0}-{1}.txt" -f $WSMProjectGUID, (Get-Date -Format ("yyyyMMdd-HHmmss"))) -Encoding ("utf8") -Force; # Optional - Output to file (txt)
65+
Export-Clixml -InputObject $DisconnectedPages -Path ("C:\Temp\Result-RemovedExpiredPages-{0}-{1}.xml" -f $WSMProjectGUID, (Get-Date -Format ("yyyyMMdd-HHmmss"))) -Force; # Optional - Output to file (object)
66+
67+
#Show-MSSession; # Optional
68+
Exit-MSSession -UseDefaults ($true);
69+
Unregister-MSSession -UseDefaults ($true);
70+
71+
Unregister-MSConfigStore;

Scripts/Maintenance/Start-RemoveUnlinkedPagesFromProject.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Enter-MSSession -UseDefaults ($true);
1010
#$WSMProjectGUID = ("072d6659-a806-425b-aca8-d29f37fd6e7d"); # Vodafone Internet
1111
#$WSMProjectGUID = ("6A89CD93325D42FD81A42FA836547016"); # Vodafone Internet - Fachhandel Online
1212
#$WSMProjectGUID = ("107CB9590FBB4C1AB7B8F7FE2449EE85"); # Vodafone Internet - Innovation Park
13-
#$WSMProjectGUID = ("8C681C01ECE44FC8B1FB45C4A7760501"); # Vodafone Intranet
13+
#$WSMProjectGUID = ("8C681C01ECE44FC8B1FB45C4A7760501"); # Vodafone Intranet (AskVodafone)
1414
#$WSMProjectGUID = ("BA2A9869B57D4BA89E598F6B4B48F0B6"); # Vodafone Mobile
1515
#$WSMProjectGUID = ("771B99172E8B404794FA805EF961EF57"); # vodafone Applications - MobileApp
1616
#$WSMProjectGUID = ("8A300F4B74AA4D4CB5C54C2165FC56D1"); # Shared Components - Simplicity
@@ -57,7 +57,7 @@ while ($UnlinkedPages.Count -gt 0) {
5757
Write-Progress -Activity ("Finished...") -PercentComplete ($ValuePercentComplete) -CurrentOperation ("{0}% complete" -f [math]::Round($ValuePercentComplete)) -Status ("Please wait - Sending output to console.");
5858

5959
#$RemovedUnlinkedPages | Select-Object -Property ("guid", "id", "headline", "status", "flags") | Format-Table; # Optional
60-
#$RemovedUnlinkedPages | Select-Object -Property ("guid", "id", "headline", "status", "flags") | Format-Table | Out-File -FilePath ("C:\Temp\Result-RemovedUnlinkedPages-{0}.txt" -f $WSMProjectGUID) -Encoding ("utf8") -Force; # Optional - Output to file
60+
#$RemovedUnlinkedPages | Select-Object -Property ("guid", "id", "headline", "status", "flags") | Format-Table | Out-File -FilePath ("C:\Temp\Result-RemovedUnlinkedPages-{0}-{1}.txt" -f $WSMProjectGUID, (Get-Date -Format ("yyyyMMdd-HHmmss"))) -Encoding ("utf8") -Force; # Optional - Output to file
6161

6262
#Show-MSSession; # Optional
6363
Exit-MSSession -UseDefaults ($true);

SmartConsole.psd1

218 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)