Problem:
Ich habe nach einer Möglichkeit gesucht den Internet Explorer von der Taskleiste auf unseren Terminalservern zu entfernen und den Edge dafür zu setzen. Die Ernüchterung war, dass Unpin funktioniert, aber Pin nicht mehr unterstützt wird. Somit konnte ich zumindest den Internet Explorer von der Taskleiste entfernen.
Unpin App from Tasskbar
Deutsches OS
$appname = "Internet Explorer"
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Von Taskleiste lösen'} | %{$_.DoIt(); $exec = $true}
Englisches OS
$appname = "Internet Explorer"
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Unpin from taskbar'} | %{$_.DoIt(); $exec = $true}
Ich stelle hier ein paar Skripte zur Verfügung, welche einem die Migration eines Printservers etwas vereinfachten. Selbstverständlich kann man das auch mir Printmig oder anderen Tools durchführen. Ich wollte meinen neuen Printserver from scratch neu installieren, daher der etwas andere Weg. Die Migration wird in vier Teile erfolgen:
Part #1: Export TCP- und LPR-Ports
Part #2: Export Drucker mit allen Settings in eine XML-Datei
Part #3: Import TCP- und LPR-Ports
Part #4: Import aller Drucker mit allen Settings
WICHTIG: Vor dem nächsten schritt müssen erst alle nötigen Druckertreiber installiert werden. Sollte sich der Name oder die Version der Druckertreiber ändern, dann müssen diese vorher in der exportierten CSV-Datei angepasst werden.
Nachdem die Druckertreiber installiert wurden, kann man mit einem
Get-PrinterDriver dir Druckertreiber anzeigen lassen. Hier findet man unter dem Punkt "Name" den Namen, welcher in der CSV entsprechend ausgetauscht werden muss. Sollte der Name nicht übereinstimmen, dann erhält man einen Fehler bei der Erstellung des Druckers, dass der Treiber nicht gefunden wurde. Nachdem dir Treiber installiert sind und die CSV ggf. angepasst wurde, können dir Drucker nun per Powershell erstellt werden (inkl. Konfiguration aus der XML).
Hinweis: Es hat sich gezeigt, dass Etikettendrucker nochmals gesondert geprüft werden müssen, da manche Informationen nicht im Windows-Treiber gespeichert wird (Druckkopf-Konfiguration).
Außerdem benötigt die Erstellung von Druckern, welche offline sind, ca. 1 Minute (TCP-Timeout).
Create-Printers_from_CSV.ps1
<#
.NAME
Create-Printers_from_CSV.ps1
.AUTHOR
Ralf Entner
.SYNOPSIS
Script creates all printers from a csv file. Config will be restored by import xml file.
.DESCRIPTION
Script creates all printers with all settings from a csv and xml file.
With the testmode $true you can run the script without any changes. It will only show whatif
A log file will be created
.NOTES
You have to install the printer drivers on the system before you run the script.
printer driver names must be changed in the csv file if it differs from the original names.
If the pritner is offline the creation will take approximal 1 mintue.
.COMPONENT
No powershell modules needed
.LINK
No Links
.Parameter ParameterName
$CSVPath - Define export path of the csv file
$Testmode - Defines testmode: $true = test | $false = live
$Logpath - Path for log file
#>
#Testmode ($true = active | $false = inactive)
$Testmode = $false
# CSV Import path
$CSVPath = "C:\tgswinv\Printmig\Printers.csv"
# XML import path
$XMLPath = "C:\tgswinv\Printmig\"
# Log File
$Logpath = "C:\tgswinv\Printmig\CreatePrinter.log"
#Start transciption
Start-Transcript -Path $Logpath -Append
# Import Printers
$Printers = Import-Csv -Path $CSVPath -Delimiter ";"
foreach($Printer in $Printers){
if(!(Get-Printer -Name $Printer.Name -ErrorAction SilentlyContinue))
{
Write-Host "Generating new pritner" $Printer.Name -ForegroundColor Green
# If port not exists create a new one with parameters from csv import
Add-Printer -Name $Printer.Name -PortName $Printer.Portname -DriverName $Printer.Drivername -Location $Printer.Location -Comment $Printer.Comment -WhatIf:$Testmode
Start-Sleep -Seconds 2
Write-Host "Import printer configuration from xml" $Printer.Name -ForegroundColor Green
# If port not exists create a new one with parameters from csv import
# Generate printer configuration path to xml file
$XMLConfigFile = $XMLPath + $Printer.Name + ".xml"
# Import printer configuration from xml file
$XMLConfig = Get-Content $XMLConfigFile | Out-String
# Set printer configuration from xml file
Set-PrintConfiguration -PrinterName $Printer.Name -PrintTicketXml $XMLConfig -WhatIf:$Testmode
}
}
Stop-Transcript
Ich stelle hier ein paar Skripte zur Verfügung, welche einem die Migration eines Printservers etwas vereinfachten. Selbstverständlich kann man das auch mir Printmig oder anderen Tools durchführen. Ich wollte meinen neuen Printserver from scratch neu installieren, daher der etwas andere Weg. Die Migration wird in vier Teile erfolgen:
Part #1: Export TCP- und LPR-Ports
Part #2: Export Drucker mit allen Settings in eine XML-Datei
Part #3: Import TCP- und LPR-Ports
Part #4: Import aller Drucker mit allen Settings
Part #3: Import TCP- und LPR-Ports
Jetzt können wir die TCP- und LPR-Ports auf dem neuen Printserver erstellen lassen.
Auch hier gibt es wieder zwei Skripte, da TCP-Ports anders erzeugt werden als LPD-Ports.
ACHTUNG: Vor der Erstellung der LPR-Ports muss der LPD-Service erst über den Servermanager installiert werden, damit der LPR-Porttype zur Verfügung steht.
TIPP: Sollten die Namen oder die IPs der Ports geändert werden, dann bitte vorher in der CSV anpassen!
Create-Printerports_TCP_from_CSV.ps1
<#
.NAME
Create-Printerports_TCP_from_CSV.ps1
.AUTHOR
Ralf Entner
.SYNOPSIS
Script creates all TCP Printer Ports from a csv file.
.DESCRIPTION
Script creates all TCP Printer Ports with all settings from a csv file. In the csv file there are address, port number and smtp settings.
.NOTES
With the testmode $true you can run the script without any changes. It will only show whatif
.COMPONENT
No powershell modules needed
.LINK
No Links
.Parameter ParameterName
$CSVPath - Define import path of the csv file
$Testmode - Defines testmode: $true = test | $false = live
#>
$CSVPath = "C:\tgswinv\Printmig\PortsTCP.csv"
$Testmode = $false
# Import CSV with Port Informations
$PrinterPorts = Import-CSV -Path $CSVPath -Delimiter ";"
# Loop through
Foreach($Port in $PrinterPorts){
Write-Host "Creating Printerport $Name"
# Check if Printerport already exists
if(!(Get-PrinterPort -Name $Port.Name -ErrorAction SilentlyContinue))
{
Add-PrinterPort -Name $Port.Name -PrinterHostAddress $Port.PrinterHostAddress -PortNumber $Port.Portnumber -SNMPCommunity $Port.SNMPCommunity -SNMP $true -WhatIf:$Testmode
}
}
Create-Printerports_LPR_from_CSV.ps1
<#
.NAME
Create-Printerports_LPR_from_CSV.ps1
.AUTHOR
Ralf Entner
.SYNOPSIS
Script creates all LPR Printer Ports from a csv file.
.DESCRIPTION
Script creates all LPR Printer Ports with all settings from a csv file.
In the csv file there are name, protocol, port nubmer and printer host address.
.NOTES
With the testmode $true you can run the script without any changes. It will only show whatif
.COMPONENT
ATTENTION: You have to install the LPR printer monitor before you add the ports!
No powershell modules needed
.LINK
No Links
.Parameter ParameterName
$CSVPath - Define import path of the csv file
$Testmode - Defines testmode: $true = test | $false = live
#>
$CSVPath = "C:\tgswinv\Printmig\PortsLPR.csv"
$Testmode = $false
# Import CSV with Port Informations
$PrinterPorts = Import-CSV -Path $CSVPath -Delimiter ";"
# Loop through
Foreach($Port in $PrinterPorts){
Write-Host "Creating Printerport "$Port.Name
# Check if Printerport already exists
if(!(Get-PrinterPort -Name $Port.Name -ErrorAction SilentlyContinue))
{
#Add-PrinterPort -Name $Port.PrinterName -PrinterHostAddress $Port.hostname -WhatIf:$Testmode
Add-PrinterPort -PrinterName $Port.Printername -HostName $port.Hostname -WhatIf:$Testmode
}
}
Ich stelle hier ein paar Skripte zur Verfügung, welche einem die Migration eines Printservers etwas vereinfachten. Selbstverständlich kann man das auch mir Printmig oder anderen Tools durchführen. Ich wollte meinen neuen Printserver from scratch neu installieren, daher der etwas andere Weg. Die Migration wird in vier Teile erfolgen:
Part #1: Export TCP- und LPR-Ports
Part #2: Export Drucker mit allen Settings in eine XML-Datei
Part #3: Import TCP- und LPR-Ports
Part #4: Import aller Drucker mit allen Settings
Part #2: Export Drucker mit allen Settings in eine XML-Datei
Mit dem nachfolgenden Skript erfolgt der Export aller installierten Drucker, welche Netzwerkdrucker sind. Es wird eine CSV mit den grundlegenden Druckerinformationen erstellt. Außerdem wird für jeden Drucker die Konfiguration in eine XML-Datei exportiert, welche die komplette Konfiguration der Schächte und Papierquellen etc. enthält. Mit diesen Informationen können später die Drucker vollständig auf dem neuen Server wiederhergestellt werden.
Export-Printer_and_Printerconfiguration.ps1
<#
.NAME
Export-Printer_and_Printerconfiguration.ps1
.AUTHOR
Ralf Entner
.SYNOPSIS
Script exports all network printers and printer settings.
.DESCRIPTION
Script exports all network Printers with all settings to a single csv file.
The printer configurations are also exported in a xml file for each printer name (printername.xml)
The export includes name, shared name, port name, driver name, location, comment und publishing information.
.NOTES
The script exports only network printers.
.COMPONENT
No powershell modules needed
.LINK
No Links
.Parameter ParameterName
$CSVPath - Define export path of the csv file
$XMLPath - Define export path of xml file for each printer configuration
#>
# Export CSV path
$CSVPath = "C:\Printmig\Printers.csv"
$XMLPath = "C:\Printmig\"
# Get all printers and informtaions
$Printers = Get-Printer | ?{$_.PortName -ne "PORTPROMPT:"} | select Name, ShareName, PortName, DriverName, Location, Comment, Published, Shared
# Export Printers to csv
$Printers | Export-Csv -Path $CSVPath -Delimiter ";" -Encoding UTF8 -NoTypeInformation
Foreach ($Printer in $Printers){
#Exportpaht for XML
$XMLFilePath = $XMLPath + $Printer.Name + ".xml"
# Export PrinterConfiguration to XML
$GPC = get-printconfiguration -PrinterName $Printer.Name
$GPC.PrintTicketXML | out-file $XMLFilePath
}
Ich stelle hier ein paar Skripte zur Verfügung, welche einem die Migration eines Printservers etwas vereinfachten. Selbstverständlich kann man das auch mir Printmig oder anderen Tools durchführen. Ich wollte meinen neuen Printserver from scratch neu installieren, daher der etwas andere Weg. Die Migration wird in vier Teile erfolgen:
Part #1: Export TCP- und LPR-Ports
Part #2: Export Drucker mit allen Settings in eine XML-Datei
Part #3: Import TCP- und LPR-Ports
Part #4: Import aller Drucker mit allen Settings
Part #1: Export TCP- und LPR-Ports
Für den späteren Import der zwei Port-Typen werden unterschiedliche Informationen benötigt, daher habe ich hierfür zwei Skripte erstellt, welche die Konfigurationen exportieren:
Export-PrinterPorts_TCP_to_CSV.ps1
<#
.NAME
Export-PrinterPorts_TCP_to_CSV.ps1
.AUTHOR
Ralf Entner
.SYNOPSIS
Script exports all TCP Printer Ports to a csv file.
.DESCRIPTION
Script exports all TCP Printer Ports with all settings to a csv file. In the csv file there are address, port number and smtp settings.
.NOTES
The script exports only TCP Ports, not LPR Ports (see other script).
.COMPONENT
No powershell modules needed
.LINK
No Links
.Parameter ParameterName
$CSVPath - Define export path of the csv file
#>
# Export CSV path
$CSVPath = "C:\Printmig\PortsTCP.csv"
# Get Printerports with all nessesary informations
$Printerports = Get-PrinterPort | ?{$_.Description -like "*TCP*"} | select Name, PrinterHostAddress, PortNumber, SNMPCommunity, SNMPEnabled
#Export informations to CSV
$Printerports | Export-Csv -Path $CSVPath -Delimiter ";" -Encoding UTF8 -NoTypeInformation
Export-PrinterPorts_LPR_to_CSV.ps1
<#
.NAME
Export-PrinterPorts_LPR_to_CSV.ps1
.AUTHOR
Ralf Entner
.SYNOPSIS
Script exports all LPR Printer Ports to a csv file.
.DESCRIPTION
Script exports all LPR Printer Ports with all settings to a csv file. In the csv file there are name, protocol, port nubmer and printer host address.
.NOTES
The script exports only LPR Ports, not TCP Ports (see other script).
.COMPONENT
No powershell modules needed
.LINK
No Links
.Parameter ParameterName
$CSVPath - Define export path of the csv file
#>
# Export CSV path
$CSVPath = "C:\Printmig\PortsLPR.csv"
# Get Printerports with all nessesary informations
$Printerports = Get-PrinterPort | ?{$_.PortMonitor -eq "LPR Port"} | Select-Object Name, Protocol, PortNumber, PrinterHostAddress
#Export informations to CSV
$Printerports | Export-Csv -Path $CSVPath -Delimiter ";" -Encoding UTF8 -NoTypeInformation
Problem
Ich habe einen KMS Server aufgesetzt und das Volume Activation Management Tool (VAMT) installiert um die Produkt Keys zu aktivieren. Dabei konnte ich die Server 2019 Keys nicht hinzufügen. Server 2016 und Server 2022 haben problemlos funktioniert. Beim Server 2019 habe ich immer die folgende Fehlermeldung erhalten:
The specified product key is invalid or is unspported by this version of VAMT.
An update to support additional products may be available online.
Ursache
Nach einiger Internetsuche bin ich auf ähnliche Einträge mit anderen Windows Versionen gestoßen. Scheinbar kann das VAMT den Schlüssel nicht korrekt identifizieren. Die Identifikation erfolgt über die pkconfig Files im Ordner
C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\VAMT3\pkconfig
auf dem VAMT Server.
Lösung
Nach etwas Recherche hat sich gezeigt, dass diese Dateien auch auf den jeweiligen Server-/Client-Betriebssystemen existieren. Diese findet man unter
C:\Windows\System32\spp\tokens\pkeyconfig
Hier geht es um die dort befindliche Datei
pkeyconfig-csvlk.xrm-ms
Diese ist auf dem VAMT-Server auch bereits vorhanden. Die Lösung sieht nun wie folgt aus:
- Datei
pkeyconfig-csvlk.xrm-ms auf dem VAMT-Server umbenennen
- Datei vom zu aktivierenden OS in das Verzeichnis kopieren (in meinem Fall von einem Server 2019)
- VAMT starten und Produkt Key eintragen
- VAMT schließen und originale Datei
pkeyconfig-csvlk.xrm-ms auf dem VAMT-Server wieder umbenennen
Ich habe das Problem nicht bei Mircrosoft identifizieren können. Es gab scheinbar beim Server 2012 R2 schon mal das Problem. Dieser Artikel hat mich zumindest auf die richtige Spur gebracht.
Quelle:
Microsoft Learn: VAMT known issues