76 lines
3.7 KiB
PowerShell
76 lines
3.7 KiB
PowerShell
# 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
|
||
} |