Wmic Abfrage u. anhand des Herstellers, Modell Ordner erstellen
Hallo,
ich würde gerne eine wmic Abfrage kombinieren den Hersteller und das Modell auslesen (wmic csproduct get vendor, version) und dann Ordner bzw. Unterordner erzeugen lassen anhand des Herstellers bzw. Modell als Unterordner, wenn diese noch nicht vorhanden sind.
zum Beispiel:
d:\LENOVO\ThinkPad T410\
Danke für Eure Hilfe!
ich würde gerne eine wmic Abfrage kombinieren den Hersteller und das Modell auslesen (wmic csproduct get vendor, version) und dann Ordner bzw. Unterordner erzeugen lassen anhand des Herstellers bzw. Modell als Unterordner, wenn diese noch nicht vorhanden sind.
zum Beispiel:
d:\LENOVO\ThinkPad T410\
Danke für Eure Hilfe!
Please also mark the comments that contributed to the solution of the article
Content-Key: 666351
Url: https://administrator.de/contentid/666351
Printed on: April 18, 2024 at 01:04 o'clock
2 Comments
Latest comment
cls
$Attr = Get-WmiObject -Class Win32_ComputerSystem -ComputerName . | Select-Object -Property *
$Hersteller = $attr.Manufacturer
$Modell = $attr.Model
$Pfad = "Y:\Temp\"+$Hersteller
$Subpfad = $Pfad +"\"+$Modell
if(Test-path -Path $Pfad) {
if(!(Test-Path $Subpfad)) {
New-Item -Path $Subpfad -ItemType directory
}
} else {
New-Item -Path $Pfad -ItemType directory
New-Item -Path $Subpfad -ItemType directory
}
Y:\TEMP\ => D:\