Bonjour
J'ai un soucis avec ce script :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 $dir = "\\domaine.net\enterprise\groupes\Groupe Commun\Public_Informatique\macList\*.txt" $destFile = "\\domaine.net\enterprise\groupes\Groupe Commun\Public_Informatique\macList\mdtMacList.txt" if (Test-Path $destFile){del $destFile} dir $dir | Import-Csv | foreach { $name = $_.name $mac = $_.macAddress $out = "[$mac]", "ComputerName=$name", "SkipComputerName=YES", "" Write-Host $name $mac Add-Content $destFile $out } Write-Host "le résultat est sauvé dans le fichier : " -ForegroundColor Green (dir $destFile).fullname
J'obtiens l'erreur suivante :
Pouvez-vous m'aider ? merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Import-Csv : Vous devez spécifier le paramètre -Path ou -LiteralPath, mais pas les deux. Au caractère H:\Scripts\MAC_MDT.ps1:6 : 12 + dir $dir | Import-Csv | foreach { + ~~~~~~~~~~ + CategoryInfo : InvalidData : (:) [Import-Csv], InvalidOperationException + FullyQualifiedErrorId : CannotSpecifyPathAndLiteralPath,Microsoft.PowerShell.Commands.ImportCsvCommand le résultat est sauvé dans le fichier : dir : Impossible de trouver le chemin d'accès «\\domaine.net\enterprise\groupes\Groupe Commun\Public_Informatique\macList\mdtMacList.txt», car il n'existe pas. Au caractère H:\Scripts\MAC_MDT.ps1:19 : 2 + (dir $destFile).fullname + ~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (\\domaine.n...\mdtMacList.txt:String) [Get-ChildItem], ItemNotFound Exception + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
Partager