powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / скрипт для GPO
1 сообщений из 1, страница 1 из 1
скрипт для GPO
    #35991766
hooty88
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Здравствуйте. Есть скрипт для очистки темпов в windows.

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
Const LOCAL_SETTINGS_TEMP_INET_FILES = &H20& 
Const LOCAL_SETTINGS_RECENT_FILES = &H8& 
 
strComputer = "." 
 
On Error Resume Next 
 
' !!! oaaeaiea Temporary Internet Files !!! 
Set objShell = CreateObject("Shell.Application") 
Set objFolder = objShell.Namespace(LOCAL_SETTINGS_TEMP_INET_FILES) 
Set objFolderItem = objFolder.Self 
strInetTempFiles = objFolderItem.Path 
'Wscript.Echo "strInetTempFiles - " & strInetTempFiles 
DelFiles(strInetTempFiles) 
 
' !!! oaaeaiea Recent Files History !!! 
Set objShell = CreateObject("Shell.Application") 
Set objFolder = objShell.Namespace(LOCAL_SETTINGS_RECENT_FILES) 
Set objFolderItem = objFolder.Self 
strRecentFiles = objFolderItem.Path 
'Wscript.Echo "strRecentFiles - " & strRecentFiles 
'DelFiles(strRecentFiles) 
 
' !!! I?enoea iaiee User TEMP !!! 
Set objWMIService = GetObject("winmgmts:" _ 
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
Set colItems = objWMIService.ExecQuery("Select * from Win32_BootConfiguration") 
For Each objItem in colItems 
    strUserTempDir = objItem.TempDirectory 
    'Wscript.Echo "User Temp Directory: " & strUserTempDir 
Next 
DelFiles(strUserTempDir) 
 
' !!! I?enoea iaiee System TEMP !!! 
Set objWMIService = GetObject("winmgmts:" _ 
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
 
Set colItems = objWMIService.ExecQuery("Select * from Win32_Environment WHERE (Name = 'TMP' or Name = 'TEMP') and  SystemVariable = True") 
 
For Each objItem in colItems 
    strSystemTempDir = objItem.VariableValue 
    'Wscript.Echo "System Temp Directory: " & strSystemTempDir 
Next 
DelFiles(strSystemTempDir) 
 
'Wscript.Echo outLog 
 
Function DelFiles(strSourceDir) 
    Dim lfsObject 
    Dim lFileList 
    Dim lFolder 
    Dim lFile 
 
    'Is this a valid call? 
    If strSourceDir > "" Then 
        On Error Resume Next 
        Set lfsObject = CreateObject("Scripting.FileSystemObject") 
        Set lFolder = lfsObject.GetFolder(strSourceDir) 
        'Wscript.Echo "lFolder - " & lFolder 
 
        'Process contained files first 
        Set lFileList = lFolder.Files 
        'Wscript.Echo "lFileList - " & lFileList 
        For Each lFile in lFileList 
            'Wscript.Echo "lFile - " & lFile 
            lFile.Delete 
        Next      
 
        'Process subdirectories 
        Set lSubFolders = lFolder.SubFolders 
 
        For Each lSubFolder in lSubFolders 
            NewSource = strSourceDir & "\" & lSubFolder.Name 
            'Wscript.Echo "NewSource - " & NewSource 
            'Recursive call to delete all subdirectories 
            DelFiles NewSource 
            'Delete this directory 
            lSubFolder.Delete 
        Next 
 
        'Cleanup 
        Set lfsObject = Nothing 
        Set lFileList = Nothing 
        Set lFolder = Nothing 
        Set lFile = Nothing 
    End If 
End Function


Если нет ошибок, то правильно ли я делаю, закидывая код в "name.vbs" и запуская его через GPO?
Если здесь всё правильно, почему он может не выполняться?
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / скрипт для GPO
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]