Can't open PowerShell with administrative rights - windows

I'm running Windows 10 and a few weeks ago I managed to do something (in the middle of the night - can't remember) such that I can't open PowerShell (nor PowerShell ISE) with administrative rights anymore. When opening it via right-click -> as admin, the Shell opens and closes immediately. Opening without administrative rights works fine.
I managed to find the error through opening a cmd as admin and typing the command "PowerShell". It says (translated):
"The type initializer for "System.Management.Automation.Runspaces.LocalRunspace" caused an exception"
Google seems not to come up with similar cases. Any suggestions?

you could Try the new PowerShell Core it can do everything the normal powershell can do too
and its opensource :)
PowerShell Core

I solved it. The problem was, that I had changed the registry entries in "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion" to "%ProgramFiles%" a while ago, in an attempt to change the default location of new programs to whichever path I defined in the environment variable. Now I hardcoded it to my new desired location (on D:). I can open the PowerShell as admin again.

Related

Windows 10 quick access links docfile corrupted

In Windows 10, my quick access links have been broken for a while. I upgraded to the Pro Insider build 17025 and now get a new error "The docfile has been corrupted"
Thanks to Alexander_ALX on Microsoft dev forums.
Type cmd in search bar, right click on Command Prompt and Run as Administrator
Run this:
del %appdata%\microsoft\windows\recent\automaticdestinations*
Close all File Explorers. When you re-open a fresh one, Quick Access will be alive again with the default settings and you can now pin folders to it

C:\windows\SysWow64\CScript.exe window pop up

I created a macro in Excel and i am running it from a .vbs file. It's working fine on my laptop. I copied the same work on a new laptop and each time i am running the vbs file this window appears on the screen.
I have made some research and read that the situation i mentioned is happening when loading CheckNDISPort service on the startup. But i don't believe it's the reason because when i go to task manager and check in the startUp tab i don't find this service. Also when i restart my laptop i don't get this window, only when i am running my vbs file. I am sure there is any problem with my vbs file too because on the other laptops it's working fine.
Any suggestion please how to get ride of this pop up ? For now i am closing the window each time or ending the task from task manager but everytime i run it again so it pops up again.
Thank you very much.
Windows Scripting Host has two interpreter front-ends, wscript.exe and cscript.exe. cscript.exe is a console application and if cscript.exe is set as the default a console window will open every time you execute a script.
Run cmd.exe elevated as administrator and run wscript.exe //h:wscript.
Depending on the Windows version, you might also be able to right-click a .vbs file, select "Open with...", choose %windir%\system32\wscript.exe and check the "default" checkbox.

Unable to create database using DBCA

I have installed Oracle 11g on Windows 7 successfully. But, when I am creating a database using DBCA, it says init.ora (access denied), at the last step, and stops. I logged into the system using admin.
I have manually changed the settings of that directory where the DB file is created. But have had no success. Does anyone have a solution?
This is in Oracle 12c running on my Windows 10 PC.
Right click on the "CMD" before opening the command prompt and
Click on "RUN AS ADMINISTRATOR" so the command prompt opened with Full Administrator privileges
Call the "DBCA" assist by typing DBCA in this command window
The database creator assistant opens, and everything after this step goes very well.
Sounds like you haven't followed the installation guide. A typical error if you have not added the user to the domain group.
I jumped into the same issue today. The issue will keeping come out no matter you're logged in as admin or not (in most cases, we logged in as admin, same as me).
I get pass the issue as : press Windows key to open Start Menu, type in 'dbca', when dbca.bat shows up in Programs, right click and select 'Run as administrator', everything goes fine now !

Win7: What's the difference between starting Windows Explorer in Admin Mode vs. cmd.exe in Admin mode?

I am currently using a VB-Skript, which is used to start a setup.exe file, which requires administrative privilleges in order to be installed correctly, if it is not started as an administrator it will return a corresponding error message. Both the script and the setup are located on a window share that is located in a network classified as "Worokplace" in Win7 (32 Bit).
I have the foloowing strange effect, which I do not understand:
I run explorer.exe as "Administrator", and start the script by doubleclicking, which results in a final errormessage that setup.exe requires administrative privileges in order to run. I thought that when I run explorer.exe as Administrator, all other processes started within will have the same privileges.
I tried the same by starting cmd.exe as an Administrator, run the vbs by simply typing myscript.vbs, and the installation succeeds.
Obviously, the same script started from explorer with administrative rights and started from cmd.exe with administrative right finally gets different privilleges, which is what I do not understand at all. Can anybody please explain what's going on there?
Thanks alot
Any process can start a child process, and the parent process can choose what environment (including access rights) the child process will run in. The difference is simply that cmd.exe allows child processes to inherit its own environment, while explorer.exe will only apply administrator privileges if it has been told to do so, either by right-click and 'Run as administrator' or by editing the properties of a shortcut.
The bottom line is simply that they are coded that way.

Can't add new Redirected Port in Windows 7 after installing RedMon

My operating system is Windows 7 32bit. I installed RedMon1.7, Ghostscript 8.71 and GSview 4.9; installations were successful.
I went to Add New Local Printer in Windows Devices and Printers, clicked on Create A New Port, and selected Redirected Port from the Type of Port list. Clicked Next and in the Add New Port window I named RPT1: and clicked OK but it says Specified port cannot be added. Operation could not be completed (error 0x00000001)
I tried giving different names to the port, RPT2:, RPT4:, VPport: etc but all gave same result. Disabled Windows Firewall and tried but it continues to give same error, Disabled the Antivirus (Avira) but no change.
What can be preventing windows 7 from adding redirected port?
BTW I was following instructions in this tutorial in order to create a postscript printer.
http://www.stat.tamu.edu/~henrik/GSPSprinter/GSPSprinter.html
Appreciate any ideas or suggestions. Thanks
Run cmd.exe as Administrator and then run:
rundll32 printui.dll,PrintUIEntry /il
from the elevated cmd.
Go to your Start Menu,
Type Print,
Right-Click "Print Management",
Select "Run as administrator",
In Print Management; Expand "Print Servers" and Select "Ports".
Right-Click in the "Ports" pane (on the right hand side) and Select "Add Port...".
I'd also recommend configuring a Port from Print Management, as opposed to trying to do it in a Printers Properties. ;)
Adam Reed describes a workaround in his blog:
http://borntoidentify.blogspot.com/2010/09/configuring-virtual-printer-using.html
Not very comfortable, but works for me ...
EDIT: This link appears broken, but here's the content:
https://web.archive.org/web/20120628120209/http://borntoidentify.blogspot.com/2010/09/configuring-virtual-printer-using.html
The gist is that under Win7, you need to run explorer with elevated rights. This can be done using another browser, or, as mentioned in the comments on the original post:
Open a CMD window by right clicking and running as administrator
Kill the process explorer.exe from the task manager
Run explorer.exe from the command prompt window, now as an administrator.
Be very careful when running explorer as an administrator.
You need to enable Admin mode OR log with the Admin account!
This is cause by the new Vista/Win 7 security system.
Try reseting the firewall (Windows 7)
(be warned tho, the firewall will reset to the default setting)
*go to Control Panel
*go to Windows Firewall
*on the left choice pick "Restore Defaults"
It works for me, i hope it works for you.
F3lix's rundll32 method works but after you've created the port you most probably would need to configure its settings. Elsewhere in the net there are instructions to open Port management as Administrator, but in Windows 7 Home that seems to be very much impossible. One can only view the virtual port settings. The only workaround I found is to edit registry directly with the Registry editor at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Redirected Port\Ports\RPT1:
(Replace your port name in the end.)
It seams to be tricky. In my case it only works, after creating an new User account with the name "admin" / group " Administratoren" (de).
Before with my real Nickname User "Nick.." / group "Administratoren" (de) it dosent work´.
Takes several hours to discover ...
Accepted solution did not work for me...I found an other command line that worked well (I'm on windows 10):
%systemroot%\system32\printmanagement.msc
It opens the print management in administrator mode, and I was able to create the port with no problems.

Resources