PowerShell: Cannot Be Loaded Because Running Scripts is Disabled

KB ID 0001417

Problem

If you’ve arrived here, you are trying to run a script, and you cant;

[box]PS C:\Users\{User-name}> .\{script-name}.ps1
.\{script-name} : File C:\Users\{User-name}\{script-name} cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at
http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\{script-name}
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\\{User-name}>[/box]

 

Solution

 Execute the following command;

[box]Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass[/box]

Then run your script.

THIS WILL ONLY WORK: While that PowerShell window is open, so don’t close it if you are running a lot of scripts.

I Want to Always be Able to Run Scripts?

OK you can either change the ‘Scope’ of that last command, from ‘Process’ to to ‘CurrentUser’, or ‘CurrentMachine’.

  • Process: The execution policy affects only the current Windows PowerShell process.
  • CurrentUser: The execution policy affects only the current user.
  • LocalMachine: The execution policy affects all users of the computer.

Or you can simply change the policy ‘Globally’;

[box]Set-ExecutionPolicy {Value}[/box]

Possible values are;

  • Restricted: Does not load configuration files or run scripts. Restricted is the default execution policy.
  • AllSigned: Requires that all scripts and configuration files be signed by a trusted publisher, including scripts that you write on the local computer.
  • RemoteSigned: Requires that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.
  • Unrestricted: Loads all configuration files and runs all scripts. If you run an unsigned script that was downloaded from the Internet, you are prompted for permission before it runs.
  • Bypass: Nothing is blocked and there are no warnings or prompts.
  • Undefined: Removes the currently assigned execution policy from the current scope. This parameter will not remove an execution policy that is set in a Group Policy scope.

Related Articles, References, Credits, or External Links

NA

Symantec AntiVirus Asks For Password During Uninstall

KB ID 0000894 

Problem

I was finishing off a domain migration this week and was changing the clients over to McAfee. On one machine I found it had Symantec AntiVirus. When I tried to remove it, it asked for a password.

One of the other machines had Symantec Endpoint Protection installed and this did the same.

As expected, no one knew what this password was, and the default password ‘symantec’ didn’t work.

Solution

The same fix worked for both of them, and its painfully easy. While still being asked for the password, do the following.

1. Launch Task Manager, (Press Ctrl+Alt+Delete, Or right click the taskbar, or simply run Taskmgr.exe).

2. Select the processes tab, Locate the MSIEXEC.EXE service. Note: There may be more than one, if so select the one that running under the user account that you a logged on as DO NOT select it is it is running under the SYSTEM account. End the process.

3. Now the password request box will have disappeared, and the uninstall process will complete on its own.

Related Articles, References, Credits, or External Links

NA

Windows – Disable the ‘Lock Screen’

Lock Screen KB ID 0000670

Problem

Also See: Stop Windows Servers ‘Locking’ with Group Policy

The Windows  lock screen is all well and good if you have a slate/tablet, but I don’t see the point of it on a Desktop PC or Laptop, (it just adds to login time).

Note: don’t get this confused with Stop Windows Asking For Password After Sleep / Standby

Lock Screen: Solution

1. Bring up the Windows run command (Press Windows Key+R). Then execute the gpedit.msc command, (Local Policy Editor)

2. Navigate to the following location;

[box]

Computer Configuration > Administrative Templates > Control Panel > Personalization > Do not display the lock screen

[/box]

3. Open the policy and set it to enabled.

Stop Windows Lock Screen via Domain Group Policy

Same place as above!

 

Related Articles, References, Credits, or External Links

NA