Ca me paraissait =E0 priori simple, mais dans le=20
dossier "RECYCLER", il ya les corbeilles des diff=E9rents=20
users en SID.... super pas pratique !
Ya un moyen simple (genre une focntion VBS direct) ou va=20
falloir bidouiller un programme expr=E8s ?
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
scraper
Bonjour loup (dans news:097001c4b10d$72fbeae0$) tu nous disais :
Bonjour,
Ca me paraissait à priori simple, mais dans le dossier "RECYCLER", il ya les corbeilles des différents users en SID.... super pas pratique ! Ya un moyen simple (genre une focntion VBS direct) ou va falloir bidouiller un programme exprès ?
Attention ! Adresse mail invalide ... Pour me contacter, cliquez sur le lien ci-dessous: http://scraper.chez.tiscali.fr/contact.htm
scraper
Bonjour loup
(dans news:097001c4b10d$72fbeae0$a601280a@phx.gbl)
tu nous disais :
Bonjour,
Ca me paraissait à priori simple, mais dans le
dossier "RECYCLER", il ya les corbeilles des différents
users en SID.... super pas pratique !
Ya un moyen simple (genre une focntion VBS direct) ou va
falloir bidouiller un programme exprès ?
Bonjour loup (dans news:097001c4b10d$72fbeae0$) tu nous disais :
Bonjour,
Ca me paraissait à priori simple, mais dans le dossier "RECYCLER", il ya les corbeilles des différents users en SID.... super pas pratique ! Ya un moyen simple (genre une focntion VBS direct) ou va falloir bidouiller un programme exprès ?
hummm, c'est gentil mais j'préférerais quelque chose purement VBS...
-----Message d'origine-----
Bonjour loup (dans news:097001c4b10d$72fbeae0$) tu nous disais :
ooops !
oublie le post cie dessus ... rien à voir :-)
désolé
.... euh ... peut être coder une dll qui sera appelée par ton script ? :-)
tu en veux une ? :-)
--
Attention ! Adresse mail invalide ... Pour me contacter, cliquez sur le lien ci-dessous: http://scraper.chez.tiscali.fr/contact.htm
scraper
.
Alain CROS
Bonjour
C'est pas top! mais ...
Alain CROS
--Corbeille.vbs
TransfertCorbeilleAvecShell BrowseRepFile("Choisir le fichier a supprimer", True, Empty) Function TransfertCorbeilleAvecShell(Choix) Dim ObjShell, ObjFolderaJeter, ObjFolderItem Const ssfDRIVES = 17 '(&H11) On Error Resume Next Set ObjShell = CreateObject("Shell.Application") On Error GoTo 0 If ObjShell Is Nothing Then Exit Function Set ObjFolderaJeter = ObjShell.NameSpace(ssfDRIVES).ParseName(Choix) For Each ObjFolderItem In ObjFolderaJeter.Parent.Items If ObjFolderItem = ObjFolderaJeter Then On Error Resume Next ObjFolderItem.Verbs.Item(ObjFolderItem.Verbs.Count - 2).DoIt If Err.Number <> 0 Then ObjFolderItem.InvokeVerb ("&Supprimer") ObjFolderItem.InvokeVerb ("&Delete") End If On Error GoTo 0 Exit For End If Next 'ObjFolderItem Set ObjFolderItem = Nothing Set ObjFolderaJeter = Nothing Set ObjShell = Nothing End Function Function BrowseRepFile(Msg, LeType, RepRacine) Dim ObjShell, objfolder, ObjFolderItem, Param, LeMsg Const BIF_BROWSEINCLUDEFILES = &H4000 Const BIF_RETURNONLYFSDIRS = &H1 ' Ces constantes sont connues de vba mais doivent être déclarées en vbs Const ssfDESKTOPDIRECTORY = 16 ' (&H10) Const ssfDESKTOP = 0 On Error Resume Next Set ObjShell = CreateObject("Shell.Application") On Error GoTo 0 If Not IsObject(ObjShell) Then Exit Function Param = BIF_RETURNONLYFSDIRS If Not IsEmpty(LeType) Then Param = Param + BIF_BROWSEINCLUDEFILES End If If IsEmpty(RepRacine) Then RepRacine = ssfDESKTOP Set objfolder = ObjShell.BrowseForFolder(&H0&, Msg, Param, RepRacine) If objfolder Is Nothing Then Exit Function On Error Resume Next BrowseRepFile = objfolder.ParentFolder.ParseName(objfolder.Title).Path On Error GoTo 0 If BrowseRepFile = "" Then If objfolder = ObjShell.NameSpace(ssfDESKTOP) Then With ObjShell.NameSpace(ssfDESKTOPDIRECTORY) BrowseRepFile = .ParentFolder.ParseName(.Title).Path End With Else For Each ObjFolderItem In objfolder.ParentFolder.Items If ObjFolderItem = objfolder Then BrowseRepFile = ObjFolderItem.Path Exit For End If Next End If End If Set ObjFolderItem = Nothing Set objfolder = Nothing Set ObjShell = Nothing End Function
--Corbeille.vbs
"loup" a écrit dans le message de news: 097001c4b10d$72fbeae0$ Bonjour,
Ca me paraissait à priori simple, mais dans le dossier "RECYCLER", il ya les corbeilles des différents users en SID.... super pas pratique ! Ya un moyen simple (genre une focntion VBS direct) ou va falloir bidouiller un programme exprès ?
Merci de vos avis éclairés.
Bonjour
C'est pas top! mais ...
Alain CROS
--Corbeille.vbs
TransfertCorbeilleAvecShell BrowseRepFile("Choisir le fichier a supprimer", True, Empty)
Function TransfertCorbeilleAvecShell(Choix)
Dim ObjShell, ObjFolderaJeter, ObjFolderItem
Const ssfDRIVES = 17 '(&H11)
On Error Resume Next
Set ObjShell = CreateObject("Shell.Application")
On Error GoTo 0
If ObjShell Is Nothing Then Exit Function
Set ObjFolderaJeter = ObjShell.NameSpace(ssfDRIVES).ParseName(Choix)
For Each ObjFolderItem In ObjFolderaJeter.Parent.Items
If ObjFolderItem = ObjFolderaJeter Then
On Error Resume Next
ObjFolderItem.Verbs.Item(ObjFolderItem.Verbs.Count - 2).DoIt
If Err.Number <> 0 Then
ObjFolderItem.InvokeVerb ("&Supprimer")
ObjFolderItem.InvokeVerb ("&Delete")
End If
On Error GoTo 0
Exit For
End If
Next 'ObjFolderItem
Set ObjFolderItem = Nothing
Set ObjFolderaJeter = Nothing
Set ObjShell = Nothing
End Function
Function BrowseRepFile(Msg, LeType, RepRacine)
Dim ObjShell, objfolder, ObjFolderItem, Param, LeMsg
Const BIF_BROWSEINCLUDEFILES = &H4000
Const BIF_RETURNONLYFSDIRS = &H1
' Ces constantes sont connues de vba mais doivent être déclarées en vbs
Const ssfDESKTOPDIRECTORY = 16 ' (&H10)
Const ssfDESKTOP = 0
On Error Resume Next
Set ObjShell = CreateObject("Shell.Application")
On Error GoTo 0
If Not IsObject(ObjShell) Then Exit Function
Param = BIF_RETURNONLYFSDIRS
If Not IsEmpty(LeType) Then
Param = Param + BIF_BROWSEINCLUDEFILES
End If
If IsEmpty(RepRacine) Then RepRacine = ssfDESKTOP
Set objfolder = ObjShell.BrowseForFolder(&H0&, Msg, Param, RepRacine)
If objfolder Is Nothing Then Exit Function
On Error Resume Next
BrowseRepFile = objfolder.ParentFolder.ParseName(objfolder.Title).Path
On Error GoTo 0
If BrowseRepFile = "" Then
If objfolder = ObjShell.NameSpace(ssfDESKTOP) Then
With ObjShell.NameSpace(ssfDESKTOPDIRECTORY)
BrowseRepFile = .ParentFolder.ParseName(.Title).Path
End With
Else
For Each ObjFolderItem In objfolder.ParentFolder.Items
If ObjFolderItem = objfolder Then
BrowseRepFile = ObjFolderItem.Path
Exit For
End If
Next
End If
End If
Set ObjFolderItem = Nothing
Set objfolder = Nothing
Set ObjShell = Nothing
End Function
--Corbeille.vbs
"loup" <anonymous@discussions.microsoft.com> a écrit dans le message de news: 097001c4b10d$72fbeae0$a601280a@phx.gbl...
Bonjour,
Ca me paraissait à priori simple, mais dans le
dossier "RECYCLER", il ya les corbeilles des différents
users en SID.... super pas pratique !
Ya un moyen simple (genre une focntion VBS direct) ou va
falloir bidouiller un programme exprès ?
TransfertCorbeilleAvecShell BrowseRepFile("Choisir le fichier a supprimer", True, Empty) Function TransfertCorbeilleAvecShell(Choix) Dim ObjShell, ObjFolderaJeter, ObjFolderItem Const ssfDRIVES = 17 '(&H11) On Error Resume Next Set ObjShell = CreateObject("Shell.Application") On Error GoTo 0 If ObjShell Is Nothing Then Exit Function Set ObjFolderaJeter = ObjShell.NameSpace(ssfDRIVES).ParseName(Choix) For Each ObjFolderItem In ObjFolderaJeter.Parent.Items If ObjFolderItem = ObjFolderaJeter Then On Error Resume Next ObjFolderItem.Verbs.Item(ObjFolderItem.Verbs.Count - 2).DoIt If Err.Number <> 0 Then ObjFolderItem.InvokeVerb ("&Supprimer") ObjFolderItem.InvokeVerb ("&Delete") End If On Error GoTo 0 Exit For End If Next 'ObjFolderItem Set ObjFolderItem = Nothing Set ObjFolderaJeter = Nothing Set ObjShell = Nothing End Function Function BrowseRepFile(Msg, LeType, RepRacine) Dim ObjShell, objfolder, ObjFolderItem, Param, LeMsg Const BIF_BROWSEINCLUDEFILES = &H4000 Const BIF_RETURNONLYFSDIRS = &H1 ' Ces constantes sont connues de vba mais doivent être déclarées en vbs Const ssfDESKTOPDIRECTORY = 16 ' (&H10) Const ssfDESKTOP = 0 On Error Resume Next Set ObjShell = CreateObject("Shell.Application") On Error GoTo 0 If Not IsObject(ObjShell) Then Exit Function Param = BIF_RETURNONLYFSDIRS If Not IsEmpty(LeType) Then Param = Param + BIF_BROWSEINCLUDEFILES End If If IsEmpty(RepRacine) Then RepRacine = ssfDESKTOP Set objfolder = ObjShell.BrowseForFolder(&H0&, Msg, Param, RepRacine) If objfolder Is Nothing Then Exit Function On Error Resume Next BrowseRepFile = objfolder.ParentFolder.ParseName(objfolder.Title).Path On Error GoTo 0 If BrowseRepFile = "" Then If objfolder = ObjShell.NameSpace(ssfDESKTOP) Then With ObjShell.NameSpace(ssfDESKTOPDIRECTORY) BrowseRepFile = .ParentFolder.ParseName(.Title).Path End With Else For Each ObjFolderItem In objfolder.ParentFolder.Items If ObjFolderItem = objfolder Then BrowseRepFile = ObjFolderItem.Path Exit For End If Next End If End If Set ObjFolderItem = Nothing Set objfolder = Nothing Set ObjShell = Nothing End Function
--Corbeille.vbs
"loup" a écrit dans le message de news: 097001c4b10d$72fbeae0$ Bonjour,
Ca me paraissait à priori simple, mais dans le dossier "RECYCLER", il ya les corbeilles des différents users en SID.... super pas pratique ! Ya un moyen simple (genre une focntion VBS direct) ou va falloir bidouiller un programme exprès ?
Merci de vos avis éclairés.
loup
Merci mais c'est trop tard.... finalement j'ai réussi à pondre un programme moi même :) Ci dessous.... PS: j'vais comparer ton code juste pour apprendre ou améliorer le mien, merci !
-----Message d'origine----- Bonjour
C'est pas top! mais ...
Alain CROS
--Corbeille.vbs
TransfertCorbeilleAvecShell BrowseRepFile("Choisir le fichier a supprimer", True, Empty)
Function TransfertCorbeilleAvecShell(Choix) Dim ObjShell, ObjFolderaJeter, ObjFolderItem Const ssfDRIVES = 17 '(&H11) On Error Resume Next Set ObjShell = CreateObject("Shell.Application") On Error GoTo 0 If ObjShell Is Nothing Then Exit Function Set ObjFolderaJeter = ObjShell.NameSpace (ssfDRIVES).ParseName(Choix)
For Each ObjFolderItem In ObjFolderaJeter.Parent.Items If ObjFolderItem = ObjFolderaJeter Then On Error Resume Next ObjFolderItem.Verbs.Item (ObjFolderItem.Verbs.Count - 2).DoIt
If Err.Number <> 0 Then ObjFolderItem.InvokeVerb ("&Supprimer") ObjFolderItem.InvokeVerb ("&Delete") End If On Error GoTo 0 Exit For End If Next 'ObjFolderItem Set ObjFolderItem = Nothing Set ObjFolderaJeter = Nothing Set ObjShell = Nothing End Function Function BrowseRepFile(Msg, LeType, RepRacine) Dim ObjShell, objfolder, ObjFolderItem, Param, LeMsg Const BIF_BROWSEINCLUDEFILES = &H4000 Const BIF_RETURNONLYFSDIRS = &H1 ' Ces constantes sont connues de vba mais doivent être déclarées en vbs
Const ssfDESKTOPDIRECTORY = 16 ' (&H10) Const ssfDESKTOP = 0 On Error Resume Next Set ObjShell = CreateObject("Shell.Application") On Error GoTo 0 If Not IsObject(ObjShell) Then Exit Function Param = BIF_RETURNONLYFSDIRS If Not IsEmpty(LeType) Then Param = Param + BIF_BROWSEINCLUDEFILES End If If IsEmpty(RepRacine) Then RepRacine = ssfDESKTOP Set objfolder = ObjShell.BrowseForFolder(&H0&, Msg, Param, RepRacine)
If objfolder Is Nothing Then Exit Function On Error Resume Next BrowseRepFile = objfolder.ParentFolder.ParseName (objfolder.Title).Path
On Error GoTo 0 If BrowseRepFile = "" Then If objfolder = ObjShell.NameSpace(ssfDESKTOP) Then With ObjShell.NameSpace(ssfDESKTOPDIRECTORY) BrowseRepFile = .ParentFolder.ParseName (.Title).Path
End With Else For Each ObjFolderItem In objfolder.ParentFolder.Items
If ObjFolderItem = objfolder Then BrowseRepFile = ObjFolderItem.Path Exit For End If Next End If End If Set ObjFolderItem = Nothing Set objfolder = Nothing Set ObjShell = Nothing End Function
--Corbeille.vbs
"loup" a écrit dans le message de news: 097001c4b10d$72fbeae0
$
Bonjour,
Ca me paraissait à priori simple, mais dans le dossier "RECYCLER", il ya les corbeilles des différents users en SID.... super pas pratique ! Ya un moyen simple (genre une focntion VBS direct) ou va falloir bidouiller un programme exprès ?
Merci de vos avis éclairés.
.
Merci mais c'est trop tard.... finalement j'ai réussi
à pondre un programme moi même :)
Ci dessous....
PS: j'vais comparer ton code juste pour apprendre ou
améliorer le mien, merci !
-----Message d'origine-----
Bonjour
C'est pas top! mais ...
Alain CROS
--Corbeille.vbs
TransfertCorbeilleAvecShell BrowseRepFile("Choisir le
fichier a supprimer", True, Empty)
Function TransfertCorbeilleAvecShell(Choix)
Dim ObjShell, ObjFolderaJeter, ObjFolderItem
Const ssfDRIVES = 17 '(&H11)
On Error Resume Next
Set ObjShell = CreateObject("Shell.Application")
On Error GoTo 0
If ObjShell Is Nothing Then Exit Function
Set ObjFolderaJeter = ObjShell.NameSpace
(ssfDRIVES).ParseName(Choix)
For Each ObjFolderItem In ObjFolderaJeter.Parent.Items
If ObjFolderItem = ObjFolderaJeter Then
On Error Resume Next
ObjFolderItem.Verbs.Item
(ObjFolderItem.Verbs.Count - 2).DoIt
If Err.Number <> 0 Then
ObjFolderItem.InvokeVerb ("&Supprimer")
ObjFolderItem.InvokeVerb ("&Delete")
End If
On Error GoTo 0
Exit For
End If
Next 'ObjFolderItem
Set ObjFolderItem = Nothing
Set ObjFolderaJeter = Nothing
Set ObjShell = Nothing
End Function
Function BrowseRepFile(Msg, LeType, RepRacine)
Dim ObjShell, objfolder, ObjFolderItem, Param, LeMsg
Const BIF_BROWSEINCLUDEFILES = &H4000
Const BIF_RETURNONLYFSDIRS = &H1
' Ces constantes sont connues de vba mais doivent être
déclarées en vbs
Const ssfDESKTOPDIRECTORY = 16 ' (&H10)
Const ssfDESKTOP = 0
On Error Resume Next
Set ObjShell = CreateObject("Shell.Application")
On Error GoTo 0
If Not IsObject(ObjShell) Then Exit Function
Param = BIF_RETURNONLYFSDIRS
If Not IsEmpty(LeType) Then
Param = Param + BIF_BROWSEINCLUDEFILES
End If
If IsEmpty(RepRacine) Then RepRacine = ssfDESKTOP
Set objfolder = ObjShell.BrowseForFolder(&H0&, Msg,
Param, RepRacine)
If objfolder Is Nothing Then Exit Function
On Error Resume Next
BrowseRepFile = objfolder.ParentFolder.ParseName
(objfolder.Title).Path
On Error GoTo 0
If BrowseRepFile = "" Then
If objfolder = ObjShell.NameSpace(ssfDESKTOP) Then
With ObjShell.NameSpace(ssfDESKTOPDIRECTORY)
BrowseRepFile = .ParentFolder.ParseName
(.Title).Path
End With
Else
For Each ObjFolderItem In
objfolder.ParentFolder.Items
If ObjFolderItem = objfolder Then
BrowseRepFile = ObjFolderItem.Path
Exit For
End If
Next
End If
End If
Set ObjFolderItem = Nothing
Set objfolder = Nothing
Set ObjShell = Nothing
End Function
--Corbeille.vbs
"loup" <anonymous@discussions.microsoft.com> a écrit dans
le message de news: 097001c4b10d$72fbeae0
$a601280a@phx.gbl...
Bonjour,
Ca me paraissait à priori simple, mais dans le
dossier "RECYCLER", il ya les corbeilles des différents
users en SID.... super pas pratique !
Ya un moyen simple (genre une focntion VBS direct) ou va
falloir bidouiller un programme exprès ?
Merci mais c'est trop tard.... finalement j'ai réussi à pondre un programme moi même :) Ci dessous.... PS: j'vais comparer ton code juste pour apprendre ou améliorer le mien, merci !
-----Message d'origine----- Bonjour
C'est pas top! mais ...
Alain CROS
--Corbeille.vbs
TransfertCorbeilleAvecShell BrowseRepFile("Choisir le fichier a supprimer", True, Empty)
Function TransfertCorbeilleAvecShell(Choix) Dim ObjShell, ObjFolderaJeter, ObjFolderItem Const ssfDRIVES = 17 '(&H11) On Error Resume Next Set ObjShell = CreateObject("Shell.Application") On Error GoTo 0 If ObjShell Is Nothing Then Exit Function Set ObjFolderaJeter = ObjShell.NameSpace (ssfDRIVES).ParseName(Choix)
For Each ObjFolderItem In ObjFolderaJeter.Parent.Items If ObjFolderItem = ObjFolderaJeter Then On Error Resume Next ObjFolderItem.Verbs.Item (ObjFolderItem.Verbs.Count - 2).DoIt
If Err.Number <> 0 Then ObjFolderItem.InvokeVerb ("&Supprimer") ObjFolderItem.InvokeVerb ("&Delete") End If On Error GoTo 0 Exit For End If Next 'ObjFolderItem Set ObjFolderItem = Nothing Set ObjFolderaJeter = Nothing Set ObjShell = Nothing End Function Function BrowseRepFile(Msg, LeType, RepRacine) Dim ObjShell, objfolder, ObjFolderItem, Param, LeMsg Const BIF_BROWSEINCLUDEFILES = &H4000 Const BIF_RETURNONLYFSDIRS = &H1 ' Ces constantes sont connues de vba mais doivent être déclarées en vbs
Const ssfDESKTOPDIRECTORY = 16 ' (&H10) Const ssfDESKTOP = 0 On Error Resume Next Set ObjShell = CreateObject("Shell.Application") On Error GoTo 0 If Not IsObject(ObjShell) Then Exit Function Param = BIF_RETURNONLYFSDIRS If Not IsEmpty(LeType) Then Param = Param + BIF_BROWSEINCLUDEFILES End If If IsEmpty(RepRacine) Then RepRacine = ssfDESKTOP Set objfolder = ObjShell.BrowseForFolder(&H0&, Msg, Param, RepRacine)
If objfolder Is Nothing Then Exit Function On Error Resume Next BrowseRepFile = objfolder.ParentFolder.ParseName (objfolder.Title).Path
On Error GoTo 0 If BrowseRepFile = "" Then If objfolder = ObjShell.NameSpace(ssfDESKTOP) Then With ObjShell.NameSpace(ssfDESKTOPDIRECTORY) BrowseRepFile = .ParentFolder.ParseName (.Title).Path
End With Else For Each ObjFolderItem In objfolder.ParentFolder.Items
If ObjFolderItem = objfolder Then BrowseRepFile = ObjFolderItem.Path Exit For End If Next End If End If Set ObjFolderItem = Nothing Set objfolder = Nothing Set ObjShell = Nothing End Function
--Corbeille.vbs
"loup" a écrit dans le message de news: 097001c4b10d$72fbeae0
$
Bonjour,
Ca me paraissait à priori simple, mais dans le dossier "RECYCLER", il ya les corbeilles des différents users en SID.... super pas pratique ! Ya un moyen simple (genre une focntion VBS direct) ou va falloir bidouiller un programme exprès ?
Merci de vos avis éclairés.
.
loup
onst FILE01 = "C:Documents and SettingsAll UsersMenu_ DémarrerCatalogue Windows.lnk" Const FILE02 = "C:Documents and SettingsAll UsersMenu_ DémarrerConfigurer les programmes par défaut.lnk" Const FILE03 = "C:Documents and SettingsAll UsersMenu_ Démarrerdesktop.ini" Const FILE04 = "C:Documents and SettingsAll UsersMenu_ DémarrerWindows Update.lnk" Const CORBEILLE = "C:RECYCLER" Const DOM = "DOMAINE"
Dim Computer,objWMIService,objWMI,Query,colItems,objItem,SID,De stination,fso,WshNetwork,shell,USER
Set WshNetwork = WScript.CreateObject("WScript.Network") Set shell = WScript.CreateObject("WScript.Shell") 'WScript.Echo "Nom de l'utilisateur : " & _WshNetwork.UserName USER = WshNetwork.Username
Computer = "."
Set fso = CreateObject("Scripting.FileSystemObject") objWMI="winmgmts:" & Computer & "rootcimv2" Set objWMIService = GetObject(objWMI) Query="Select * from Win32_AccountSID" Set colItems = objWMIService.ExecQuery(Query,,48) For Each objItem in colItems Set SID=getobject("winmgmts:" & objItem.Setting) With SID
'wscript.echo .AccountName
'Filtre pour retrouver la clé SID du user If .AccountName = USER Then If .ReferencedDomainName = DOM Then
wscript.echo "Clé SID: " & .SID Destination = CORBEILLE & .SID & "" fso.MoveFile FILE01,Destination wscript.echo FILE01 fso.MoveFile FILE02,Destination wscript.echo FILE02 fso.MoveFile FILE03,Destination wscript.echo FILE03 fso.MoveFile FILE04,Destination wscript.echo FILE04 Wscript.quit End If End If End With Next
onst FILE01 = "C:Documents and SettingsAll UsersMenu_
DémarrerCatalogue Windows.lnk"
Const FILE02 = "C:Documents and SettingsAll UsersMenu_
DémarrerConfigurer les programmes par défaut.lnk"
Const FILE03 = "C:Documents and SettingsAll UsersMenu_
Démarrerdesktop.ini"
Const FILE04 = "C:Documents and SettingsAll UsersMenu_
DémarrerWindows Update.lnk"
Const CORBEILLE = "C:RECYCLER"
Const DOM = "DOMAINE"
Dim
Computer,objWMIService,objWMI,Query,colItems,objItem,SID,De
stination,fso,WshNetwork,shell,USER
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set shell = WScript.CreateObject("WScript.Shell")
'WScript.Echo "Nom de l'utilisateur : " &
_WshNetwork.UserName
USER = WshNetwork.Username
Computer = "."
Set fso = CreateObject("Scripting.FileSystemObject")
objWMI="winmgmts:\" & Computer & "rootcimv2"
Set objWMIService = GetObject(objWMI)
Query="Select * from Win32_AccountSID"
Set colItems = objWMIService.ExecQuery(Query,,48)
For Each objItem in colItems
Set SID=getobject("winmgmts:" & objItem.Setting)
With SID
'wscript.echo .AccountName
'Filtre pour retrouver la clé SID du user
If .AccountName = USER Then
If .ReferencedDomainName = DOM Then
wscript.echo "Clé SID: " & .SID
Destination = CORBEILLE & .SID & ""
fso.MoveFile FILE01,Destination
wscript.echo FILE01
fso.MoveFile FILE02,Destination
wscript.echo FILE02
fso.MoveFile FILE03,Destination
wscript.echo FILE03
fso.MoveFile FILE04,Destination
wscript.echo FILE04
Wscript.quit
End If
End If
End With
Next
onst FILE01 = "C:Documents and SettingsAll UsersMenu_ DémarrerCatalogue Windows.lnk" Const FILE02 = "C:Documents and SettingsAll UsersMenu_ DémarrerConfigurer les programmes par défaut.lnk" Const FILE03 = "C:Documents and SettingsAll UsersMenu_ Démarrerdesktop.ini" Const FILE04 = "C:Documents and SettingsAll UsersMenu_ DémarrerWindows Update.lnk" Const CORBEILLE = "C:RECYCLER" Const DOM = "DOMAINE"
Dim Computer,objWMIService,objWMI,Query,colItems,objItem,SID,De stination,fso,WshNetwork,shell,USER
Set WshNetwork = WScript.CreateObject("WScript.Network") Set shell = WScript.CreateObject("WScript.Shell") 'WScript.Echo "Nom de l'utilisateur : " & _WshNetwork.UserName USER = WshNetwork.Username
Computer = "."
Set fso = CreateObject("Scripting.FileSystemObject") objWMI="winmgmts:" & Computer & "rootcimv2" Set objWMIService = GetObject(objWMI) Query="Select * from Win32_AccountSID" Set colItems = objWMIService.ExecQuery(Query,,48) For Each objItem in colItems Set SID=getobject("winmgmts:" & objItem.Setting) With SID
'wscript.echo .AccountName
'Filtre pour retrouver la clé SID du user If .AccountName = USER Then If .ReferencedDomainName = DOM Then
wscript.echo "Clé SID: " & .SID Destination = CORBEILLE & .SID & "" fso.MoveFile FILE01,Destination wscript.echo FILE01 fso.MoveFile FILE02,Destination wscript.echo FILE02 fso.MoveFile FILE03,Destination wscript.echo FILE03 fso.MoveFile FILE04,Destination wscript.echo FILE04 Wscript.quit End If End If End With Next