Sie sind auf Seite 1von 4

Script for getting Total ram in remote desktop in network @echo off cls set ab=220 set _IP=

pause :start set _sys=UNAVAILABLE set _mem==" " FOR /F "tokens=1 delims= " %%A IN ('NBTSTAT -a 10.246.12.%ab% ^| FIND "<20>" ') DO set _sys=%%A for /f "tokens=4* delims= " %%A in ('systeminfo /s %_sys% ^| find "Total Physical Memory:" ' ) do set _mem=%%A set _IP="10.246.12.%ab%" echo %_sys%, %_IP%, %_mem% MB >> .\RamStatus(TRNG).log echo system name is : %_sys% (%_IP%) Memory is : %_mem% MB set /a ab=%ab%+1 IF ab==239 ( echo end of batch file pause exit ) goto start

Script for deleting temp and cookies ECHO-----------------------------------------------------------------ECHO Deleting Temp Files from All Profiles ECHO-----------------------------------------------------------------cd\ del /f /a /s *.tmp dir /b /ad c:\"documents and settings"\ > c:\users.txt for /f "tokens=*" %%a in (c:\users.txt) do del /f /q c:\"documents and settings"\"% %a"\cookies\*.* for /f "tokens=*" %%a in (c:\users.txt) do del /f /q c:\"documents and settings"\"% %a"\"local settings"\temp\*.* for /f "tokens=*" %%a in (c:\users.txt) do rmdir /s /q c:\"documents and settings"\"% %a"\"local settings"\"Temp"\ for /f "tokens=*" %%a in (c:\users.txt) do mKdir c:\"documents and settings"\"% %a"\"local settings"\"Temp"\ for /f "tokens=*" %%a in (c:\users.txt) do rmdir /s /q c:\"documents and settings"\"% %a"\"local settings"\"Temporary internet files" for /f "tokens=*" %%a in (c:\users.txt) do mkdir c:\"documents and settings"\"% %a"\"local settings"\"Temporary Internet Files"\"Content.IE5" del /f /q c:\users.txt

'Variables Section Dim sSiteCode Dim sMachine Dim objFSO Const ForReading = 1 'Constants Section Set objFSO = CreateObject("Scripting.FileSystemObject") 'This is the file to read the names to change from Set objTextFile = objFSO.OpenTextFile(".\csite.txt", ForReading) 'SiteCode Variable sSiteCode= "PUN" Do Until objTextFile.AtEndOfStream sMachine = objTextFile.Readline wscript.echo "Changing Site Code: " & sMachine & " - " & sSiteCode ChangeSiteCode(sMachine) Loop Function ChangeSiteCode(strHost) 'Connect to the Remote Computer Namespace set oSCCMNamespace = GetObject("winmgmts://" & sMachine & "/root/ccm") Set oInstance = oSCCMNamespace.Get("SMS_Client") set oParams = oInstance.Methods_("SetAssignedSite").inParameters.SpawnInstance_() 'Change the Site Code oParams.sSiteCode = sSiteCode oSCCMNamespace.ExecMethod "SMS_Client", "SetAssignedSite", oParams set oSCCMNamespace = Nothing End Function

Const HKEY_LOCAL_MACHINE = &H80000002 Dim strComputer strComputer = InputBox("Enter computer name: ") Set objRegistry=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" strValueName = "DefaultUserName" objRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue Wscript.Echo strValue strValueName = "DefaultDomainName" objRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue Wscript.Echo strValue

Dim strComputerName strComputerName = InputBox(" Enter Computer Name: ") Set smsClient = GetObject("winmgmts://" & strComputerName & "/root/ccm:SMS_Client") Set result = smsClient.ExecMethod_("GetAssignedSite") WScript.Echo "Client is currently assigned to site " & result.sSiteCode

Das könnte Ihnen auch gefallen