Welcome, guest | Sign In | My Account | Store | Cart

This script checks what profiles are loaded with start of system. Launch it without parameters to get help.

Batch, 33 lines
 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
@echo off
  if "%1" equ "" goto:help
  setlocal enabledelayedexpansion
    set key="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
    for /f "tokens=2 delims=\" %%i in ('2^>nul reg^
     query HKEY_USERS ^| findstr /v Classes ^| sort') do (
      for %%j in ("-s", "/s") do if "%1" equ "%%~j" echo.%%i
      for %%j in ("-p", "/p") do if "%1" equ "%%~j" (
        if "%%i" equ ".DEFAULT" (
          echo.Default
        ) else (
          for /f "skip=4 tokens=2,* delims=%%" %%k in ('reg^
           query %key%\%%i /v ProfileImagePath') do (
            set "str=%%k%%l"
            if "%%k" equ "systemroot" set "str=!str:systemroot=%systemroot%!"
            if "%%k" equ "SystemDrive" set "str=!str:SystemDrive=%systemdrive%!"
            echo.!str!
          )
        )
      )
    )
  endlocal & goto:eof
  
  :help
  echo.%~n0 v2.01 - shows loaded profiles
  echo.Copyright ^(C^) 2012-2013 - greg zakharov
  echo.ActiveState - code.activestate.com
  echo.
  echo.Usage: %~n0 [/s^|/p]
  echo.   s - print SID of each profile only
  echo.   p - show profile path location
  echo.Note: Default profile is alias of S-1-5-18.
exit /b
Created by greg zakharov on Wed, 21 Nov 2012 (BSD)
Batch recipes (42)
greg zakharov's recipes (59)

Required Modules

  • (none specified)

Other Information and Tasks