Posts Tagged Microsoft

Windows Variables List

Windows Environment Variables:

Microsoft Original Document

 

Variable

Type Description
%ALLUSERSPROFILE% Local Returns the location of the All Users Profile.
%APPDATA% Local Returns the location where applications store data by default.
%CD% Local Returns the current directory string.
%CMDCMDLINE% Local Returns the exact command line used to start the current Cmd.exe.
%CMDEXTVERSION% System Returns the version number of the current Command Processor Extensions.
%COMPUTERNAME% System Returns the name of the computer.
%COMSPEC% System Returns the exact path to the command shell executable.
%DATE% System Returns the current date. Uses the same format as the date /t command. Generated by Cmd.exe. For more information about the date command, see Date
%ERRORLEVEL% System Returns the error code of the most recently used command. A non zero value usually indicates an error.
%HOMEDRIVE% System Returns which local workstation drive letter is connected to the user’s home directory. Set based on the value of the home directory. The user’s home directory is specified in Local Users and Groups.
%HOMEPATH% System Returns the full path of the user’s home directory. Set based on the value of the home directory. The user’s home directory is specified in Local Users and Groups.
%HOMESHARE% System Returns the network path to the user’s shared home directory. Set based on the value of the home directory. The user’s home directory is specified in Local Users and Groups.
%LOGONSEVER% Local Returns the name of the domain controller that validated the current logon session.
%NUMBER_OF_PROCESSORS% System Specifies the number of processors installed on the computer.
%OS% System Returns the operating system name. Windows 2000 displays the operating system as Windows_NT.
%PATH% System Specifies the search path for executable files.
%PATHEXT% System Returns a list of the file extensions that the operating system considers to be executable.
%PROCESSOR_ARCHITECTURE% System Returns the chip architecture of the processor. Values: x86, IA64.
%PROCESSOR_IDENTIFIER% System Returns a description of the processor.
%PROCESSOR_LEVEL% System Returns the model number of the processor installed on the computer.
%PROCESSOR_REVISION% System Returns the revision number of the processor.
%PROMPT% Local Returns the command prompt settings for the current interpreter. Generated by Cmd.exe.
%RANDOM% System Returns a random decimal number between 0 and 32767. Generated by Cmd.exe.
%SYSTEMDRIVE% System Returns the drive containing the Windows XP root directory (that is, the system root).
%SYSTEMROOT% System Returns the location of the Windows XP root directory.
%TEMP% and %TMP% System and User Returns the default temporary directories that are used by applications available to users who are currently logged on. Some applications require TEMP and others require TMP.
%TIME% System Returns the current time. Uses the same format as the time /t command. Generated by Cmd.exe. For more information about the time command, see Time
%USERDOMAIN% Local Returns the name of the domain that contains the user’s account.
%USERNAME% Local Returns the name of the user who is currently logged on.
%USERPROFILE% Local Returns the location of the profile for the current user.
%WINDIR% System Returns the location of the operating system directory.

 

Windows 2008 R2 Group Policy Preference Process Variables:

Microsoft Original Document

%AppDataDir% UserAppDataDir
%BinaryComputerSid% The SID of the computer in hexadecimal format.
%BinaryUserSid% The SID of the current user in hexadecimal format.
%CommonAppdataDir% The "all users" Application Data directory.
%CommonDesktopDir% The "all users" Desktop directory.
%CommonFavoritesDir% The "all users" Explorer Favorites directory.
%CommonProgramsDir% The "all users" Programs directory.
%CommonStartMenuDir% The "all users" Start Menu directory.
%CommonStartUpDir% The "all users" Startup directory.
%ComputerName% The NetBIOS name of the computer.
%CurrentProcessId% The numeric identity of the main client process.
%CurrentThreadId% The numeric identity of the main client thread.
%DateTime% The current time (UTC).
%DateTimeEx% The current time (UTC) with milliseconds.
%DesktopDir% The current user’s desktop directory.
%DomainName% The domain name or workgroup of the computer.
%FavoritesDir% The current user’s Explorer Favorites directory.
%LastError% The last error code encountered during configuration.
%LastErrorText% The last error code text description.
%LdapComputerSid% The SID of the computer in LDAP escaped binary format.
%LdapUserSid% The SID of the current user in LDAP escaped binary format.
%LocalTime% The current local time.
%LocalTimeEx% The current local time with milliseconds.
%LogonDomain% The domain of the current user.
%LogonServer% The domain controller that authenticated the current user.
%LogonUser% The user name of the current user.
%LogonUserSid% The SID of the current user.
%MacAddress% The first detected MAC address on the computer.
%NetPlacesDir% The current user’s My Network Places directory.
%OsVersion% The operating system: Windows Server® 2008 R2, Windows® 7, Windows Server® 2008, Windows Vista®, Windows Server 2003, Windows XP, or Unknown.
%ProgramFilesDir% The Windows Program Files directory.
%ProgramsDir% The current user’s Programs directory.
%RecentDocumentsDir% The current user’s Recent Documents directory.
%ResultCode% The client’s exit code.
%ResultText% The client’s exit code text description.
%ReversedComputerSid% The SID of the computer in reversed byte order hexadecimal format.
%ReversedUserSid% The SID of the current user in reversed byte order hexadecimal format.
%SendToDir% The current user’s Send to directory.
%StartMenuDir% The current user’s Start Menu directory.
%StartUpDir% The current user’s Startup directory.
%SystemDir% The Windows system directory.
%SystemDrive% The name of the drive from which the operating system is running.
%TempDir% The current user’s Temp directory as determined by Windows API.
%TimeStamp% The time stamp of the configurations being implemented.
%TraceFile% The path/name of the trace file.
%WindowsDir% The Windows directory.

No Comments

Reset Local Administrator Password On Workstations In Active Directory

Create a new file called LocalAdminPwdChg.vbs.

Copy this text into the file:

Set
WshShell = WScript.CreateObject (“WScript.Shell& #34;)
wshShell.Run
“Net User administrator NewPassword

Make sure to save the file with the extension .vbs.

Create a new Group Policy to call the LocalAdminPwdChg.vbs Script.

Configure the Script under Group Policy as follows: Computer Configuration\Windows\Settings\Scripts\Startup

No Comments

Manually Remove Active Directory From A Domain Controller

 The local Admin will be the only account available when the machine comes back up without AD.

1. Change (note – values are case sensitive)
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions]
“ProductType”=”LanmanNT” to
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions]
“ProductType”=”ServerNT”
2. Reboot
3. Delete the NTDS folder.

Remove references to the deleted server in any surviving replicas by using
NTDSUTIL metadata cleanup on a DC.

No Comments

Import User Accounts Into Active Directory With CSVDE

Use the CSVDE User Import Template to create a .csv file. Using this template requires an OU named “Import” be created in Active Directory.

Open the CMD prompt, navigate to the folder where you saved your .csv file.

Type this command: CSVDE -i -f Import.csv

No Comments

Request Company Open Volume License Information

This form is required to have Microsoft search for all Open Volume licensing information. It comes in handy when a company has changed names or has multiple aliases.

Open Customer Consent Form for eOpen

No Comments

Push VNC Installation To Workstations/Servers In A Domain

I figured out a way to push the install of VNC to PCs on a domain that do not have it installed. I got tired of walking users through trying to install it on their own. Maybe someone has an app that will do it, but I couldn’t find anything that worked.

You can use whatever version of VNC you want. As long as you get the main VNC application files.

You’ll need to get the psexec.exe file from the Microsoft SysInternals Suite in order for this to work.

In the batch file I created below. It will prompt you for a PC Name you want to install VNC On. Then it will access the Server Share to copy the files to the workstation and run psexec to start the VNC Install and Service on the Local PC.

You’ll have to use an app like Network Administrator to set a VNC password before you can connect.

Batch File:
__________________________________________________
@ECHO OFF

set /p RemotePC=Remote PC to Install VNC On –
set userinput=%RemotePC%

xcopy "\\ServerName\apps$\TightVNCInstall \*.*" "\\%RemotePC%\C$\Program Files\TightVNC\*.*" /r/i/c/h/k/e

Pause
start /D"\\ServerName\apps$\Utilities\" psexec \\%RemotePC% -s -i -d "C:\Program Files\TightVNC\winvnc.exe" -install
Pause
start /D"\\ServerName\apps$\Utilities\" psexec \\%RemotePC% -s -i -d net start "VNC Server"

Echo Run VNC Password Set to assign a VNC Password
Pause
____________________________________________________

No Comments

Display Devices That Are Not Connected To The Computer In Device Manager

MS KB 315593

  1. Click Start, point to All Programs, point to Accessories, and then click Command Prompt.
  2. At a command prompt, type the following command , and then press ENTER:
    set devmgr_show_nonpresent_devices=1
  3. Type the following command a command prompt, and then press ENTER:
    start devmgmt.msc
  4. Troubleshoot the devices and drivers in Device Manager.NOTE: Click Show hidden devices on the View menu in Device Managers before you can see devices that are not connected to the computer.
  5. When you finish troubleshooting, close Device Manager.
  6. Type exit at the command prompt.Note that when you close the command prompt window, Window clears the devmgr_show_nonpresent_devices=1 variable that you set in step 2 and prevents ghosted devices from being displayed when you click Show hidden devices.

If you are a developer or power user and you want to be able to view devices that are not connected to your computer, set this environment variable globally:

  1. Right-click My Computer.
  2. Click Properties.
  3. Click the Advanced tab.
  4. Click the Environment Variables tab.
  5. Set the variables in the System Variables box.

,

No Comments