Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
18 kB
2
Indexable
Never
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force

Add-Type -AssemblyName PresentationFramework, PresentationCore, WindowsBase, System.Windows.Forms, System.Drawing
function addRegistryKeys() {
    try {

        #Add new registry keys
        $pathToCert = "HKCU:\Software\Microsoft\Office\16.0\Common\Identity"
        New-ItemProperty -Path $pathToCert -Name DisableADALatopWAMOverride -Value 00000001 -PropertyType DWORD -Force | Out-Null
        New-ItemProperty -Path $pathToCert -Name DisableAADWAM -Value 00000001 -PropertyType DWORD -Force | Out-Null
        
        #Display messagebox, that everything is fine
        [System.Windows.MessageBox]::Show("'DisableADALatopWAMOverride' and 'DisableAADWAM' registry keys have been added to registry.",'Success',[System.Windows.MessageBoxButton]::OK,[System.Windows.MessageBoxImage]::Information)
        
        #Close window after success
        $window.Close()
    } 
    catch {
        [System.Windows.MessageBox]::Show('Something went wrong. Please contact with administrator.','Error',[System.Windows.MessageBoxButton]::OK,[System.Windows.MessageBoxImage]::Hand)
    }
}

$logoImg = @'
iVBORw0KGgoAAAANSUhEUgAAAPoAAAC5CAYAAAABICL/AAAABHNCSVQICAgIfAhkiAAAAAFzUkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAniUlEQVR4Xu2dB3xUVfbHDyXUAIEUIAGSUA2EUELvgoAgIgquoqi4q67u6t+C+v+vZXXXLerqCrqrWFZx3bUroGChSCgCUkMLnSQQQkkjJCEQ2v/+7ryRSZh5774pyZt55/v5zCeZIczcee/+zj333HPPrXVRQAzDhDS1tZ8Mw4QwLHSGsQEsdIaxASx0hrEBLHSGsQEsdIaxASx0hrEBLHSGsQEsdIaxASx0hrEBLHSGsQEsdIaxASx0hrEBLHSGsQEsdIaxASx0hrEBLHSGsQEsdIaxASx0hrEBLHSGsQEs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A38CjSLfIvNwVywgda94IoJl1veCeYuMLsuVCfb3YHVhacue+h2rKqwq+GHvM83HtzCYkoe9ix6XVRnInlom6VwWBEEQ2sdzmLrMJhgHLZ3btzK7Ia1RlWRKdzU7z80Ag90vk58vf3WVZOs/kD4Z4kGWFzjCM/wjJqDvDMJVhoTOMDWChM4wNYKEzjA1goTOMDWChM4wNYKEzjA1goTOMDWChM0zIQ/T/YFUAxcceOS8AAAAASUVORK5CYII=
'@

function DecodeBase64Image {
    param (
        [Parameter(Mandatory=$true)]
        [String]$ImageBase64
    )
    # Parameter help description
    $ObjBitmapImage = New-Object System.Windows.Media.Imaging.BitmapImage #Provides a specialized BitmapSource that is optimized for loading images using Extensible Application Markup Language (XAML).
    $ObjBitmapImage.BeginInit() #Signals the start of the BitmapImage initialization.
    $ObjBitmapImage.StreamSource = [System.IO.MemoryStream][System.Convert]::FromBase64String($ImageBase64) #Creates a stream whose backing store is memory.
    $ObjBitmapImage.EndInit() #Signals the end of the BitmapImage initialization.
    $ObjBitmapImage.Freeze() #Makes the current object unmodifiable and sets its IsFrozen property to true.
    $ObjBitmapImage
}

[xml]$XAML = @"
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		Title="Siemens - Resolve login issues" Height="450" Width="300" Background="White" ResizeMode="NoResize">
    <Grid>
        <Border BorderThickness="0" Grid.Row="0" CornerRadius="50,50,0,0" BorderBrush="Black" Background="#FFECECEC" Margin="0,163,0,0"/>
        <Button Cursor="Hand" Content="Add Registry Keys" Name="addRegKeyBtn" HorizontalAlignment="Left" Margin="65,332,0,0" VerticalAlignment="Top" Width="155" Background="White" Foreground="#FF009999" BorderBrush="#FF009999" Padding="5,8" FontWeight="Bold" FontSize="10" Height="33">
            <Button.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" Value="15"/>
                </Style>
            </Button.Resources>
        </Button>
        <Label Content="LOGIN ISSUES" HorizontalAlignment="Left" Margin="47,199,0,0" VerticalAlignment="Top" Height="37" Width="208" FontWeight="Bold" FontSize="22" FontFamily="Segoe UI Black"/>
        <Label Content="Add registry keys to supress  &#xD;&#xA;WAM and revert Outlook &#xD;&#xA;back to ADAL" HorizontalAlignment="Left" Margin="46,246,0,0" VerticalAlignment="Top" Height="81" Width="223" Background="#00000000" Foreground="#FF6E6E6E" FontSize="14" FontFamily="Corbel" FontWeight="Bold"/>
        <Label Content="Troubleshooter" HorizontalAlignment="Left" Margin="47,176,0,0" VerticalAlignment="Top" Height="26" Width="208" FontSize="14" Foreground="#FF009999" FontFamily="Ebrima" FontWeight="Bold"/>
        <Image Name="atosLogo" Margin="16,-49,26,283" Stretch="Fill"/>
        <Label Content="Developed by ATOS PL WSDS DevOps Team" HorizontalAlignment="Left" Margin="55,391,0,0" VerticalAlignment="Top" Height="22" Width="223" Background="#00000000" Foreground="Black" FontSize="8" FontWeight="Bold"/>
    </Grid>
</Window>
"@

$reader = (New-Object System.Xml.XmlNodeReader $xaml)
$window = [Windows.Markup.XamlReader]::Load($reader)

#AutoFind all controls 
$xaml.SelectNodes("//*[@*[contains(translate(name(.),'n','N'),'Name')]]")  | ForEach-Object {  
    New-Variable  -Name $_.Name -Value $window.FindName($_.Name) -Force  
}

#Find correct btn and append function to it
$addRegKeyBtn = $window.FindName("addRegKeyBtn")
$addRegKeyBtn.add_click({addRegistryKeys})

#Decode img to form
$atosLogo.Source = DecodeBase64Image -ImageBase64 $logoImg
#$window.ShowDialog()
[void]$window.ShowDialog()