Discussion:
DISKPART is now a administrator call????
(too old to reply)
T
2022-11-12 01:46:01 UTC
Permalink
Hi All,

Okay, under Windows 7, DISKPART could be run as a user.
Under W11, it need to be under an Administrator.
AAAAHHHHH!!!!

Is there a way to call diskpart that will elevate
it to administrator so I can call it from a user?
And No UAC? And no Administrator password prompt?

I am after "list Vol". Is there another way to
get this information?

Many thanks,
-T
Paul
2022-11-12 02:10:12 UTC
Permalink
Post by T
Hi All,
Okay, under Windows 7, DISKPART could be run as a user.
Under W11, it need to be under an Administrator.
AAAAHHHHH!!!!
Is there a way to call diskpart that will elevate
it to administrator so I can call it from a user?
And No UAC?  And no Administrator password prompt?
I am after "list Vol".  Is there another way to
get this information?
Many thanks,
-T
An alternate is

wmic volume > volume_list.txt
notepad volume_list.txt # Slide bottom scrollbar sideways to review table

Seems to work unelevated.

On Windows XP, that kind of query would "kick off" some
activity on the machine. You pay a price for that sort of
query on an old OS. Like, once the subsystem got started,
it would never stop.

Paul
T
2022-11-12 02:28:27 UTC
Permalink
 wmic volume
wmic volume | grep -i C:
TRUE 4096 TRUE 999561359360
C:\ FALSE

\\?\Volume{827c1456-5668-47b1-885a-e4befd7d4e91}\ C:
3 NTFS
717516595200 TRUE
255 C:\
TRUE

642282277 TRUE
TRUE FALSE

Not f
Ralph Fox
2022-11-12 02:40:23 UTC
Permalink
Post by T
Okay, under Windows 7, DISKPART could be run as a user.
Not here.
Under Windows 7, when I try to run DISKPART I get a UAC prompt.
screen-shot: <Loading Image...>
Post by T
Under W11, it need to be under an Administrator.
Same as under Windows 7 for me.
--
Kind regards
Ralph Fox

🪟️𝟟🛂️ ≍ 🪟️𝟙𝟙🛂️
T
2022-11-12 03:46:00 UTC
Permalink
Post by Ralph Fox
Post by T
Okay, under Windows 7, DISKPART could be run as a user.
Not here.
Under Windows 7, when I try to run DISKPART I get a UAC prompt.
screen-shot: <http://img4.imagetitan.com/img.php?image=25_tkmtsq_diskpart-on-windows-7-pops-a-uac-prompt.png>
Post by T
Under W11, it need to be under an Administrator.
Same as under Windows 7 for me.
Me too. I did not realize my cmd shells all
opened as administrators in W7

Any way around needing to be administrator? A
different command to get me the same thing?
Paul
2022-11-12 04:14:33 UTC
Permalink
Post by Ralph Fox
Post by T
Okay, under Windows 7, DISKPART could be run as a user.
Not here.
Under Windows 7, when I try to run DISKPART I get a UAC prompt.
     screen-shot:  <http://img4.imagetitan.com/img.php?image=25_tkmtsq_diskpart-on-windows-7-pops-a-uac-prompt.png>
Post by T
Under W11, it need to be under an Administrator.
Same as under Windows 7 for me.
Me too.  I did not realize my cmd shells all
opened as administrators in W7
Any way around needing to be administrator?  A
different command to get me the same thing?
If an elevated subsystem collects the data and
presents it to an unelevated user, that is one
way to do it (wmic).

If a probing method is "active" and the software
used reaches down to the physical layer (reads
raw sectors), well of course that needs administrator.

msinfo32.exe gives some info, but this may not
be entirely satisfactory.

Paul
T
2022-11-12 05:37:20 UTC
Permalink
Post by Paul
Post by Ralph Fox
Post by T
Okay, under Windows 7, DISKPART could be run as a user.
Not here.
Under Windows 7, when I try to run DISKPART I get a UAC prompt.
<http://img4.imagetitan.com/img.php?image=25_tkmtsq_diskpart-on-windows-7-pops-a-uac-prompt.png>
Post by T
Under W11, it need to be under an Administrator.
Same as under Windows 7 for me.
Me too.  I did not realize my cmd shells all
opened as administrators in W7
Any way around needing to be administrator?  A
different command to get me the same thing?
If an elevated subsystem collects the data and
presents it to an unelevated user, that is one
way to do it (wmic).
If a probing method is "active" and the software
used reaches down to the physical layer (reads
raw sectors), well of course that needs administrator.
msinfo32.exe gives some info, but this may not
be entirely satisfactory.
   Paul
Oh it is getting ugly. I can run my program
as Administrator, but look what happens
when I throw and `exit` or a `die` as
Administrator (user works fine):

Cowardly Exiting. Bummer Dude ...
Cannot resolve caller protect(Lock:U: Block:D); none of these signatures
matches:
(Lock:D: &code, *%_)
in method setup at C:\Program
Files\Rakudo\share\perl6\core\sources\A37F26876B58371B70EDD889AD69F064C90AC2C6
line 296
in method setup at C:\Program
Files\Rakudo\share\perl6\core\sources\A37F26876B58371B70EDD889AD69F064C90AC2C6
line 366
in sub raku-nativecall at C:\Program
Files\Rakudo\share\perl6\core\sources\A153F63283BF744FD66BF7212910E5F389384F6E
(NativeCall::Dispatcher) line 46
in sub MessageBox at Windows.RaidCheck.pl6 line 129
in sub GetRaidStatus at Windows.RaidCheck.pl6 line 115
in block <unit> at Windows.RaidCheck.pl6 line 142


Mumble, Mumble
Paul
2022-11-13 02:15:13 UTC
Permalink
Post by Paul
Post by Ralph Fox
Post by T
Okay, under Windows 7, DISKPART could be run as a user.
Not here.
Under Windows 7, when I try to run DISKPART I get a UAC prompt.
     screen-shot: <http://img4.imagetitan.com/img.php?image=25_tkmtsq_diskpart-on-windows-7-pops-a-uac-prompt.png>
Post by T
Under W11, it need to be under an Administrator.
Same as under Windows 7 for me.
Me too.  I did not realize my cmd shells all
opened as administrators in W7
Any way around needing to be administrator?  A
different command to get me the same thing?
If an elevated subsystem collects the data and
presents it to an unelevated user, that is one
way to do it (wmic).
If a probing method is "active" and the software
used reaches down to the physical layer (reads
raw sectors), well of course that needs administrator.
msinfo32.exe gives some info, but this may not
be entirely satisfactory.
    Paul
Oh it is getting ugly.  I can run my program
as Administrator, but look what happens
when I throw and `exit` or a `die` as
Cowardly Exiting.  Bummer Dude ...
    (Lock:D: &code, *%_)
  in method setup at C:\Program Files\Rakudo\share\perl6\core\sources\A37F26876B58371B70EDD889AD69F064C90AC2C6 line 296
  in method setup at C:\Program Files\Rakudo\share\perl6\core\sources\A37F26876B58371B70EDD889AD69F064C90AC2C6 line 366
  in sub raku-nativecall at C:\Program Files\Rakudo\share\perl6\core\sources\A153F63283BF744FD66BF7212910E5F389384F6E (NativeCall::Dispatcher) line 46
  in sub MessageBox at Windows.RaidCheck.pl6 line 129
  in sub GetRaidStatus at Windows.RaidCheck.pl6 line 115
  in block <unit> at Windows.RaidCheck.pl6 line 142
Mumble, Mumble  ....
What I notice here, is Diskpart is the only utility that
has a decent Status field.

This is collected from Windows 11 VM, with a Dynamic Disk RAID 1 mirror.
I removed the second container from the RAID pair, and this is the output.
(The reason I used Dynamic Disk, is there is no fake RAID hardware in VBOX.)

DISKPART> list volume

Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 Mirror 31 GB Failed <=== My 32GB RAID1 E: , one drive unplugged
Volume 1 D CD-ROM 0 B No Media
Volume 2 C NTFS Partition 63 GB Healthy Boot \
Volume 3 FAT32 Partition 100 MB Healthy System \___ GPT boot drive Win11
Volume 4 NTFS Partition 673 MB Healthy Hidden /

Whereas some of the WMIC output was, um, "not useful".

And I gotta say, that Rufus preparation tool is great.
Converted a W11 ISO to a fake USB stick in Virtualbox.
I didn't boot from the fake USB stick, but just
ran Setup.exe off it and did an Upgrade Install.
And "no tpm?", not a whisper. It all just installed.
The Upgrade Advisor thought it was OK. So there was
no need to go near VirtualBox 7 for this, the 6.1.40
did the job.

Paul
T
2022-11-13 21:57:50 UTC
Permalink
Post by Paul
Mumble, Mumble  ....
What I notice here, is Diskpart is the only utility that
has a decent Status field.
I am on the hunt toa find what api call
diskpart is making to the system to r
Zaidy036
2022-11-12 16:34:09 UTC
Permalink
Post by Ralph Fox
Post by T
Okay, under Windows 7, DISKPART could be run as a user.
Not here.
Under Windows 7, when I try to run DISKPART I get a UAC prompt.
screen-shot: <http://img4.imagetitan.com/img.php?image=25_tkmtsq_diskpart-on-windows-7-pops-a-uac-prompt.png>
Post by T
Under W11, it need to be under an Administrator.
Same as under Windows 7 for me.
would this help?
https://www.nirsoft.net/articles/run-as-different-user.html
T
2022-11-12 18:10:55 UTC
Permalink
Post by Zaidy036
Post by Ralph Fox
Post by T
Okay, under Windows 7, DISKPART could be run as a user.
Not here.
Under Windows 7, when I try to run DISKPART I get a UAC prompt.
<http://img4.imagetitan.com/img.php?image=25_tkmtsq_diskpart-on-windows-7-pops-a-uac-prompt.png>
Post by T
Under W11, it need to be under an Administrator.
Same as under Windows 7 for me.
would this help?
https://www.nirsoft.net/articles/run-as-different-user.html
Not in this instance. But I love the tool, so
I am downloading it! Nirsoft does some
sweet
Zaidy036
2022-11-13 21:50:51 UTC
Permalink
Post by Zaidy036
Post by Ralph Fox
Post by T
Okay, under Windows 7, DISKPART could be run as a user.
Not here.
Under Windows 7, when I try to run DISKPART I get a UAC prompt.
<http://img4.imagetitan.com/img.php?image=25_tkmtsq_diskpart-on-windows-7-pops-a-uac-prompt.png>
Post by T
Under W11, it need to be under an Administrator.
Same as under Windows 7 for me.
would this help?
https://www.nirsoft.net/articles/run-as-different-user.html
Not in this instance.  But I love the tool, so
I am downloading it!  Nirsoft does some
sweet stuff!
Then a batch to do the job and run it thru Task Sched as High Priority
T
2022-11-13 22:00:23 UTC
Permalink
Then a batch to do the job and run it thru Task Sched as High Priority
I am on the hunt for what api call diskpart is
making to retrieve such information
Zaidy036
2022-11-13 23:13:55 UTC
Permalink
Post by T
Then a batch to do the job and run it thru Task Sched as High Priority
I am on the hunt for what api call diskpart is
making to retrieve such information.
look at
<https://www.digitalcitizen.life/command-prompt-advanced-disk-management-commands/>
T
2022-11-14 02:15:55 UTC
Permalink
Post by Robert Roland
Post by T
Then a batch to do the job and run it thru Task Sched as High Priority
I am on the hunt for what api call diskpart is
making to retrieve such information.
look at
<https://www.digitalcitizen.life/command-prompt-advanced-disk-management-commands/>
Does not tell me ho
Zaidy036
2022-11-14 02:54:41 UTC
Permalink
Post by Robert Roland
Post by T
Then a batch to do the job and run it thru Task Sched as High Priority
I am on the hunt for what api call diskpart is
making to retrieve such information.
look at
<https://www.digitalcitizen.life/command-prompt-advanced-disk-management-commands/>
Does not tell me how to see if a partition is mirrored
How complex do you want to get? I envision a batch:
1. Open Diskpart.msc
2. Take a screen pic (jpg) of area with info wanted
3. Extract text from jpg and save to file
4. Extract info from file.
T
2022-11-14 04:01:41 UTC
Permalink
Post by Zaidy036
Post by Robert Roland
Post by T
Then a batch to do the job and run it thru Task Sched as High Priority
I am on the hunt for what api call diskpart is
making to retrieve such information.
look at
<https://www.digitalcitizen.life/command-prompt-advanced-disk-management-commands/>
Does not tell me how to see if a partition is mirrored
1. Open Diskpart.msc
2. Take a screen pic (jpg) of area with info wanted
3. Extract text from jpg and save to file
4. Extract info from file.
I think you misunderstand. I am writing a program
to run in the background unattended. I can
not get pop ups to show if I am running as an
administrator because I am running in "session 0".

I have the program written, but it has to run as
administrator to get access to diskpart. Meaning
the popus don't work.

I am trying to get away fr
Robert Roland
2022-11-12 11:42:36 UTC
Permalink
Post by T
Is there a way to call diskpart that will elevate
it to administrator so I can call it from a user?
And No UAC? And no Administrator password prompt?
If there was a way, the whole point of permissions and UAC would be
negated. Any malware would be able to use that method to gain admin
rights.
Post by T
I am after "list Vol". Is there another way to
get this information?
Take a look at PowerShell's Get-Volume. The output is not perfectly
identical, but it might still cover your needs. You can call
PowerShell cmdlets from a CMD command line (or batch file) like this:

powershell -nologo -executionpolicy bypass -command "get-volume"
--
RoRo
T
2022-11-12 12:02:38 UTC
Permalink
Post by Robert Roland
Post by T
Is there a way to call diskpart that will elevate
it to administrator so I can call it from a user?
And No UAC? And no Administrator password prompt?
If there was a way, the whole point of permissions and UAC would be
negated. Any malware would be able to use that method to gain admin
rights.
Post by T
I am after "list Vol". Is there another way to
get this information?
Take a look at PowerShell's Get-Volume. The output is not perfectly
identical, but it might still cover your needs. You can call
powershell -nologo -executionpolicy bypass -command "get-volume"
Half way there. I get healthy, but it
does not tell me mirrored

DISKPART>
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- ---------
--------
Volume 0 C NTFS Mirror 930 GB Healthy Boot
Volume 1 FAT32 Partition 100 MB Healthy
System
Volume 2 NTFS Partition 495 MB Healthy
Hidden
Volume 3 G DVD-ROM 0 B No Media
Volume 4 D LOCALBK NTFS Partition 3725 GB Healthy

DISKPART>
Leaving DiskPart...
Andy Burns
2022-11-13 20:19:53 UTC
Permalink
Post by Robert Roland
Take a look at PowerShell's Get-Volume.
Half way there.  I get healthy, but it
does not tell me mirrored
What if you look at all properties with

get-volume | format-list -property *
Andy Burns
2022-11-13 20:36:45 UTC
Permalink
Post by Andy Burns
Post by Robert Roland
Take a look at PowerShell's Get-Volume.
Half way there.  I get healthy, but it
does not tell me mirrored
What if you look at all properties with
    get-volume | format-list -property *
or get-resiliency
T
2022-11-14 02:14:12 UTC
Permalink
Post by Andy Burns
Post by Andy Burns
Post by Robert Roland
Take a look at PowerShell's Get-Volume.
Half way there.  I get healthy, but it
does not tell me mirrored
What if you look at all properties with
     get-volume | format-list -property *
or get-resiliency
Andy Burns
2022-11-14 07:00:29 UTC
Permalink
Post by Andy Burns
or get-resiliency
Does not tell me who is mirrored
probably will if you tell it which volume you're interested in?



PS C:\Users\Andy> Get-ResiliencySetting -?

NAME
Get-ResiliencySetting

SYNTAX
Get-ResiliencySetting [-Name <string[]>] [-StoragePool
<CimInstance#MSFT_StoragePool>] [-CimSession
<CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [<CommonParameters>]

Get-ResiliencySetting [-UniqueId <string[]>] [-CimSession <CimSession[]>]
[-ThrottleLimit <int>] [-AsJob]
[<CommonParameters>]

Loading...