Windows Vista Forums

oscdimg and PowerShell - quirks?

  1. #1


    perimere Guest

    oscdimg and PowerShell - quirks?

    Hi people,

    I've been playing around with converting some old CMD scripts to
    PowerShell

    I've encountered what I consider to be strange behavior, but I'm sure
    a programmer-type can probably explain

    I was trying to work out how to execute an EXE from within a PoSh
    script, and I found a few references that prefix your command with the
    &. This appears to work, though I haven't found any documentation/help
    to detail it's use.

    My issue is when I try to call the Microsoft tool: oscdimg.exe. I've
    already found the limitation that when calling executables from within
    PoSh that they need to be in the path *grumbles*....

    The command line is: &oscdimg.exe -m -n -bd:\Images\Boot\etfsboot.com
    d:\Images\x86\mount d:\Shiny.iso

    The error I'm receiving is:
    ERROR: Could not open boot sector file "D:"

    So it seems to be having issues finding the etfsboot.com file.
    Now oscdimg.exe is in the path, and the parameters are correct because
    if I run this in CMD.exe it works. It also works if I put the command
    in a CMD file and call that from PoSh (would like to avoid having to
    do though!). I have also tried putting the etfsboot.com file both in
    the path and same directory as the calling PS1 script.

    Any ideas?

    TIA

    Cheers

    Adam


      My System SpecsSystem Spec

  2. #2


    Al Dunbar Guest

    Re: oscdimg and PowerShell - quirks?


    "perimere" <adam@leadfollowmove.com> wrote in message
    news:1181215050.429689.289650@q75g2000hsh.googlegroups.com...
    > Hi people,
    >
    > I've been playing around with converting some old CMD scripts to
    > PowerShell
    >
    > I've encountered what I consider to be strange behavior, but I'm sure
    > a programmer-type can probably explain
    >
    > I was trying to work out how to execute an EXE from within a PoSh
    > script, and I found a few references that prefix your command with the
    > &. This appears to work, though I haven't found any documentation/help
    > to detail it's use.
    >
    > My issue is when I try to call the Microsoft tool: oscdimg.exe. I've
    > already found the limitation that when calling executables from within
    > PoSh that they need to be in the path *grumbles*....


    There'll be bigger grumbles when you are tricked into running a trojan
    located in the default directory because it has the same name as a benign
    executable in the path!

    All you need to is explicitly specify the default directory (assuming, of
    course, you know this is a safe executable):

    &.\oscdimg.exe ...

    > The command line is: &oscdimg.exe -m -n -bd:\Images\Boot\etfsboot.com
    > d:\Images\x86\mount d:\Shiny.iso
    >
    > The error I'm receiving is:
    > ERROR: Could not open boot sector file "D:"
    >
    > So it seems to be having issues finding the etfsboot.com file.


    I think that etfsboot.com is the "El Torito boot sector file", while
    D:\Shiny.iso is the boot sector file. In either case, oscdimg seems to have
    lost most of the path to whichever file it is having trouble with, as it
    shows only the drive.

    I'd suggest you re-try this using three different drives for the three
    parameters to see which one is the problem.

    > Now oscdimg.exe is in the path, and the parameters are correct because
    > if I run this in CMD.exe it works. It also works if I put the command
    > in a CMD file and call that from PoSh (would like to avoid having to
    > do though!). I have also tried putting the etfsboot.com file both in
    > the path and same directory as the calling PS1 script.


    Again, I'd like to confirm which file parameter is actually the problem. I
    doubt that the program or powershell is looking at your fully qualified path
    names and saying: "hmmm, he must be looking for this file somewhere on the
    path".

    /Al


    > Any ideas?
    >
    > TIA
    >
    > Cheers
    >
    > Adam
    >




      My System SpecsSystem Spec

  3. #3


    Marcel J. Ortiz [MSFT] Guest

    Re: oscdimg and PowerShell - quirks?

    > I was trying to work out how to execute an EXE from within a PoSh
    > script, and I found a few references that prefix your command with the
    > &. This appears to work, though I haven't found any documentation/help
    > to detail it's use.


    You should just be able to use the executable name if its in the PATH.
    However, if you are giving the full path to the script and it contains
    spaces, then you'll need & (& 'c:\Program Files\...').


    > My issue is when I try to call the Microsoft tool: oscdimg.exe. I've
    > already found the limitation that when calling executables from within
    > PoSh that they need to be in the path *grumbles*....


    This is true of pretty much all shells. Otherwise they would have to look
    in the whole drive. I think what you are getting at though is that it
    doesn't look in the current directory. You can change that if you want by
    adding '.' to the PATH environment variable but I wouldn't recommend it.
    Not executing from the current directory is meant to protect you from
    trojans.


    > The command line is: &oscdimg.exe -m -n -bd:\Images\Boot\etfsboot.com
    > d:\Images\x86\mount d:\Shiny.iso
    >
    > The error I'm receiving is:
    > ERROR: Could not open boot sector file "D:"


    Try sorrounding that parameter with single quotes:
    oscdimg.exe -m -n '-bd:\Images\Boot\etfsboot.com'

    I'm pretty sure its splitting it up into parameter and argument, -bd and
    \Images\boot\etfsboot.com respectively.




    "perimere" <adam@leadfollowmove.com> wrote in message
    news:1181215050.429689.289650@q75g2000hsh.googlegroups.com...
    > Hi people,
    >
    > I've been playing around with converting some old CMD scripts to
    > PowerShell
    >
    > I've encountered what I consider to be strange behavior, but I'm sure
    > a programmer-type can probably explain
    >
    > I was trying to work out how to execute an EXE from within a PoSh
    > script, and I found a few references that prefix your command with the
    > &. This appears to work, though I haven't found any documentation/help
    > to detail it's use.
    >
    > My issue is when I try to call the Microsoft tool: oscdimg.exe. I've
    > already found the limitation that when calling executables from within
    > PoSh that they need to be in the path *grumbles*....
    >
    > The command line is: &oscdimg.exe -m -n -bd:\Images\Boot\etfsboot.com
    > d:\Images\x86\mount d:\Shiny.iso
    >
    > The error I'm receiving is:
    > ERROR: Could not open boot sector file "D:"
    >
    > So it seems to be having issues finding the etfsboot.com file.
    > Now oscdimg.exe is in the path, and the parameters are correct because
    > if I run this in CMD.exe it works. It also works if I put the command
    > in a CMD file and call that from PoSh (would like to avoid having to
    > do though!). I have also tried putting the etfsboot.com file both in
    > the path and same directory as the calling PS1 script.
    >
    > Any ideas?
    >
    > TIA
    >
    > Cheers
    >
    > Adam
    >



      My System SpecsSystem Spec


oscdimg and PowerShell - quirks?
Similar Threads
Thread Forum
Powershell Quirks PowerShell
Incompatibility between Vista tool OSCDimg.exe and Powershell PowerShell
2 Strange UAC quirks Vista General
2 Strange UAC quirks Vista security
Oscdimg with PowerShell PowerShell