Important
Besoin d'aide sur un script
- jam
- Auteur du sujet
- Hors Ligne
- Nouveau membre
-
Réduire
Plus d'informations
- Messages : 1
- Remerciements reçus 0
il y a 6 ans 2 mois #29609
par jam
Besoin d'aide sur un script a été créé par jam
Salut à tous,
J'ai un script qui me permets de créer des raccourci de tous les lecteurs réseau qu'il trouve dans favoris réseau.
Sauf qu'il les créé dans le dossier des favoris réseaux et je souhaiterai qu'il le fasse sur le bureau.
Pouvez-vous m'aider à identifier la variable à modifier ?
Merci par avance.
Voici le script :
Get-ItemProperty -path hkcu:\Network\* | ForEach {
$OldOFS=$OFS
$unc = $_.RemotePath
$explode = $unc.split(\"\\")
$OFS=''
$i=0
$explode | ForEach {
$explode[$i++] = ([string]$_[0]).ToUpper()+$_[1..$_.length]
}
$OFS='_'
$sharename = $explode[$explode.length-1]+\" sur \"+$explode[2..($explode.length-2)]
$OFS=$OldOFS
$Const_NETHOOD = 0x13
$oShell = new-object -com Wscript.Shell
$oApp = new-object -com Shell.Application
$oFolder = $oApp.Namespace($Const_NETHOOD)
$oFolderItem = $oFolder.Self
$NetHood = $oFolderItem.Path
$shortcutName = \"$sharename\"
$shortcutPath = \"$unc\"
$shortcut = $oShell.CreateShortcut($NetHood\$shortcutName.lnk\")
$oShortcut.TargetPath = $shortcutPath
$oShortcut.Save()
}
J'ai un script qui me permets de créer des raccourci de tous les lecteurs réseau qu'il trouve dans favoris réseau.
Sauf qu'il les créé dans le dossier des favoris réseaux et je souhaiterai qu'il le fasse sur le bureau.
Pouvez-vous m'aider à identifier la variable à modifier ?
Merci par avance.
Voici le script :
Get-ItemProperty -path hkcu:\Network\* | ForEach {
$OldOFS=$OFS
$unc = $_.RemotePath
$explode = $unc.split(\"\\")
$OFS=''
$i=0
$explode | ForEach {
$explode[$i++] = ([string]$_[0]).ToUpper()+$_[1..$_.length]
}
$OFS='_'
$sharename = $explode[$explode.length-1]+\" sur \"+$explode[2..($explode.length-2)]
$OFS=$OldOFS
$Const_NETHOOD = 0x13
$oShell = new-object -com Wscript.Shell
$oApp = new-object -com Shell.Application
$oFolder = $oApp.Namespace($Const_NETHOOD)
$oFolderItem = $oFolder.Self
$NetHood = $oFolderItem.Path
$shortcutName = \"$sharename\"
$shortcutPath = \"$unc\"
$shortcut = $oShell.CreateShortcut($NetHood\$shortcutName.lnk\")
$oShortcut.TargetPath = $shortcutPath
$oShortcut.Save()
}
Connexion ou Créer un compte pour participer à la conversation.
- Laurent Dardenne
- Hors Ligne
- Modérateur
-
Réduire
Plus d'informations
- Messages : 6311
- Remerciements reçus 68
il y a 6 ans 2 mois #29620
par Laurent Dardenne
Tutoriels PowerShell
Réponse de Laurent Dardenne sur le sujet Re:Besoin d'aide sur un script
jamelou écrit:
docs.microsoft.com/en-us/windows/win32/a...ecialfolderconstants
Salut peut être la valeur du namespace :Pouvez-vous m'aider à identifier la variable à modifier ?
docs.microsoft.com/en-us/windows/win32/a...ecialfolderconstants
Tutoriels PowerShell
Connexion ou Créer un compte pour participer à la conversation.
Temps de génération de la page : 0.040 secondes
- Vous êtes ici :
-
Accueil
-
forum
-
PowerShell
-
Entraide pour les débutants
- Besoin d'aide sur un script