I saw your reply, but forgot to mark as solved. Instead of escaping everything as admin, I wrote a simple batch script which can be executed as admin. I'm used to the Linux way, but I need to learn...
Type: Posts; User: jnich
I saw your reply, but forgot to mark as solved. Instead of escaping everything as admin, I wrote a simple batch script which can be executed as admin. I'm used to the Linux way, but I need to learn...
The only issue with split is that I don't know how many spaces are between the columns. For instance, if I want what is in the third column, this example would not work.
$a = "ABC 69278 DEF ...
Lets say I have a string with several columns separated by spaces. The number of spaces and the data in each column are unknown. How would you grab what's in col3 using PowerShell? I know how I would...
Please forget the programs I'm using since they are irrelevant to the issue at hand.
mkdir new && cd new && echo 'test' > 1.txt
Why would this work as a regular user?
runas /user:Administrator...
I'm keenly aware. My intention is to write a one liner or batch script which does manual routine maintenance like defrag (on HDD), disk clean, defender update and scan, and windows update. I would...
Yes, the ordering was not very bright on my part. The outcome is still the same with only the first command being run.
That's good to know, but it appears to skip over the second command in PowerShell.
If I use & instead of && in CMD, it still skips the second command and gives me this error.
>The system...
runas /user:Administrator "defrag c: /V" This works.
runas /user:Administrator "cleanmgr /VERYLOWDISK" This works.
runas /user:Administrator "defrag c: /V" && "cleanmgr /VERYLOWDISK" This does...
This is where my troubles began. According to Windows, my user was the Administrator so running as that user and providing its password should have worked. I tried several times, just to be sure...
Thank you lx07! I needed to set a password for Administrator member reboot and runas /user:Administrator to get it working. I'm sorry for the confusion. chkdsk was just an example.
net localgroup administrators
Members
-----------------------------
Administrator
user
runas /user:Administrator "chkdsk c:"
<enter user, which should be administrator, pass>