8
0
Skriptentwickung/current/DD-Core/Rename-WindreamServer/Rename-WindreamServer-forUser.ps1

76 lines
3.7 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# PowerShell 2.0 Script
# Änderung des windream Servers
# Digital Data
# Ludwig-Rinn-Strasse 16
# 35452 Heuchelheim
# Tel.: 0641 / 202360
# E-Mail: info@didalog.de
# Version 1.0
# Letzte Aktualisierung: 15.10.2014
# WICHTIG: Falls sich dieses Skript nicht ausführen lässt,
# muss dieser PS-Befehl noch mit administrativen Rechten ausgeführt werden:
# set-executionpolicy unrestricted
#Requires Version 2.0
#-----------------------------------------------------------------------------------------------------
############################ Zusätzliche Assemblys hinzufügen bzw. laden. ############################
#-----------------------------------------------------------------------------------------------------
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
[void][System.Reflection.Assembly]::LoadwithPartialName("System.Windows.Forms")
#-----------------------------------------------------------------------------------------------------
######################################## Variablen definieren. #######################################
#-----------------------------------------------------------------------------------------------------
Set-variable -Name IdXPolling -Value 1000
Set-variable -Name wdServerAlt -Value "windreamserver2"
Set-variable -Name wdServerNeu -Value "windreamserver"
#-----------------------------------------------------------------------------------------------------
####################################### Funktionen definieren. #######################################
#-----------------------------------------------------------------------------------------------------
# Funktion für eine VBScript-typische Messagebox. Der Inhalt der Meldung wird in die Log Datei geschrieben.
Function Func-Show-MsgBox
{
Param
(
[Parameter(Mandatory=$true)]
[String]$Text,
[String]$Title = 'Message',
[String]$Icon = 'YesNo,Information'
)
#Func-Write-LogDatei -LogEintrag -LogEintrag "MessageBox-Inhalt: $Text"
[Microsoft.VisualBasic.Interaction]::MsgBox($text, $icon, $title)
}
$PathTest = Test-Path -Path "HKCU:\Software\A.I.S. GmbH\windream\3.6\ServerShareSelector\$wdServerAlt" -PathType Container
IF ($PathTest -eq 'True')
{
Write-Host "Alter Servereintrag wurde erkannt $wdServerAlt, wird nun ersetzt mit $wdServerNeu"
Set-ItemProperty -Path "HKCU:\Software\A.I.S. GmbH\windream\3.6\IndexServer" -Name Policy -Value $IdxPolling -Type DWord
Set-ItemProperty -Path "HKCU:\Software\A.I.S. GmbH\windream\3.6\ServerShareSelector\$wdServerAlt" -Name ClientHostName -Value $wdServerNeu -Type String
Set-ItemProperty -Path "HKCU:\Software\A.I.S. GmbH\windream\3.6\ServerShareSelector\$wdServerAlt" -Name DMSServer -Value $wdServerNeu -Type String
Set-ItemProperty -Path "HKCU:\Software\A.I.S. GmbH\windream\3.6\ServerShareSelector\$wdServerAlt" -Name TCPServer -Value $wdServerNeu -Type String
Rename-Item -Path "HKCU:\Software\A.I.S. GmbH\windream\3.6\ServerShareSelector\$wdServerAlt" -NewName $wdServerNeu
Set-ItemProperty -Path "HKCU:\Software\A.I.S. GmbH\windream\3.6\ServerShareSelector" -Name CurrentAlias -Value $wdServerNeu -Type String
Set-ItemProperty -Path "HKCU:\Software\A.I.S. GmbH\windream\3.6\ServerShareSelector" -Name VFSAlias -Value $wdServerNeu -Type String
Func-Show-MsgBox -Text "Bitte diesen Benutzer ab und wieder anmelden, damit die Änderungen wirksam werden!" -Title "$wdServerAlt -> $wdServerNeu" -Icon OKonly
}
ELSE
{
Func-Show-MsgBox -Text "Der zu ändernde Servereintrag $wdServerAlt, konnte nicht gefunden werden!" -Title "$wdServerAlt -> $wdServerNeu" -Icon OKonly
}