Announcement

Collapse
No announcement yet.

How to identify drive letter assigned to system drive.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to identify drive letter assigned to system drive.

    Hi!!
    I need some help... I trying write vbs script that determinate system drive letter and than add information to registry:
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion\Run]
    "Test1"="SYSTEMDRIVE:\\temp\\test1.cmd"
    I can find windowsdir by using simple script:
    Code:
     
    set shell = WScript.CreateObject("WScript.Shell")
    windowsdir = shell.ExpandEnvironmentStrings("%windir%")
    MsgBox(windowsdir)
    but I need to find SYSTEMDRIVE variable, to be able add it to the regestry...
    Thank you in advance,
    Igor.

  • #2
    Re: How to identify drive letter assigned to system drive.

    The windowsvariable is %systemdrive%
    To find those things you just type in SET in a command prompt.

    You might try using that in your script.
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

    Comment


    • #3
      Re: How to identify drive letter assigned to system drive.

      The windowsvariable is %systemdrive%
      Thank you!! I don't now how I forgot this... Now it's simple:

      Code:
       
      Const HKEY_CURRENT_USER = &H80000001
      strComputer = "."
      Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
       
      strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Run"
       
      strValueName = "Test1"
      strValue = "%systemdrive%\temp\test1.cmd"
      objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
      WScript.Echo "Stage1 value is set"

      Comment


      • #4
        Re: How to identify drive letter assigned to system drive.

        You're welcome
        Marcel
        Technical Consultant
        Netherlands
        http://www.phetios.com
        http://blog.nessus.nl

        MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
        "No matter how secure, there is always the human factor."

        "Enjoy life today, tomorrow may never come."
        "If you're going through hell, keep going. ~Winston Churchill"

        Comment

        Working...
        X