Vista/Windows7 - check elevated mode:

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
pkass
Posts: 2
Joined: 25 Sep 2011 03:47

Vista/Windows7 - check elevated mode:

#1 Post by pkass » 25 Sep 2011 04:09

Is there a way to check, if the cmd shell runs in elevated mode ?

Reason: in elevated mode the permissions for accessing some resources are different from the normal user and have to be treated accordingly in a batch script.

Under XP this was not a problem, because "my" standard user had simply admin permissions.

Example: I copy some files to a network drive as "standard user", and then hibernate the PC with admin permissions (without waiting for the copying to complete).

Under Windows7 in elevated mode you can not access network drives in the same way as the standard user can do (you see the drive letters but the system cannot find the drive). So, either you can copy files to the NAS OR hibernate the computer, but NOT BOTH from within the same session.

I know, there are different solutions for my problem, but currently I would follow the strategy, to simply establish a new network drive connection if I am in elevated mode.

The only solution I found so far are code snippets for the powershell. So I could run that powershell script and check the return code. But maybe there is a simpler solution ?

:-) Peter

Post Reply