windows

Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Thursday, March 29, 2018

Shutdown, Restart Computer Remotely




 Shutdown :by using PowerShell UAC “Windows administrators periodically” promotion press “start + R “ and write
“powershell start-process powershell -verb runas”

Stop Computer SYNTAX

Stop-Computer [[-ComputerName] <string[]>] [[-Credential] <pscredential>] [-AsJob] [-DcomAuthentication {Default |
    None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-WsmanAuthentication {Default |
    Basic | Negotiate | CredSSP | Digest | Kerberos}] [-Protocol {DCOM | WSMan}] [-Impersonation {Default | Anonymous
    | Identify | Impersonate | Delegate}] [-ThrottleLimit <int>] [-Force] [-WhatIf] [-Confirm]  [<CommonParameters>]

·         Computer Name: Target Computer or specifies the computers to stop. The default is the local computer.
·         Credential: Type a user name, such as User01 or Domain01\User01, or enter a PSCredential object, such as one from the Get-Credential cmdlet.
·         AsJob: When you specify the AsJob parameter, the command immediately returns an object that represents the background job. You can continue to work in the session while the job finishes. The job is created on the local computer and the results from remote computers are automatically returned to the local computer. To get the job results, use the Receive-Job cmdlet.
·         Confirm: Prompts you for confirmation before running the cmdlet.
·         DcomAuthentication: uses WMI. The acceptable values for this parameter are:
o   Default. Windows Authentication
o   None. No COM authentication
o   Connect. Connect-level COM authentication
o   Call. Call-level COM authentication
o   Packet . Packet-level COM authentication
o   PacketIntegrity. Packet Integrity-level COM authentication
o   PacketPrivacy. Packet Privacy-level COM authentication
o   Unchanged. Same as the previous command
·         Force: Forces an immediate shut down of the computers
·         Impersonation: Stop-Computer uses WMI. The acceptable values for this parameter are:
o   Default. Default impersonation.
o   Anonymous. Hides the identity of the caller.
o   Identify. Allows objects to query the credentials of the caller.
o   Impersonate. Allows objects to use the credentials of the caller.
·         Protocol: Specifies which protocol to use to restart the computers. The acceptable values for this parameter are: WSMan and DCOM. The default value is DCOM. (PowerShell v3)
·         ThrottleLimit : Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0, the default value, 32, is used.
·         WhatIf: Shows what would happen if the cmdlet runs. The cmdlet is not run

Description


Example 1:
PS C:\> Stop-Computer
This Command Stop local computer
Example 2:
PS C:\> Stop-Computer -ComputerName "Server01", "Server02", "localhost"
This command stops two remote computers, Server01 and Server02, and the local computer, identified as localhost.
Example 3:
PS C:\> Stop-Computer -ComputerName "Server01" -Impersonation Anonymous -Authentication PacketIntegrity
This command stops the Server01 remote computer. The command uses customized impersonation and authentication settings.
Example 4:
PS C:\> Stop -computer (get-content c:\work\computers.txt) -credential "mycompany\administrator"
You’ll get prompted for the password, but then this credential will be used for every computer in the list.
This might fail if you have someone logged on to the computer. In such cases you will receive below error.      
PS C:\> Stop-Computer -ComputerName Server01
Stop-Computer : This command cannot be run on target computer(‘Server01) due to following error: The system shutdown
cannot be initiated because there are other users logged on to the computer.
At line:1 char:1
+ Stop-Computer -ComputerName Server01
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Server01:String) [Stop-Computer], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StopComputerCommand


The solution in this is to use -Force switch to the above command.

PS C:\> Stop-Computer -ComputerName “Server01” –Force

Thursday, December 15, 2016

Stop or Disable Cortana in Windows 10



Cortana One of the standout new features found in Windows 10 is the addition of Cortana. For those unfamiliar, Cortana is a voice-activated personal assistant. Think of it as Siri, but for Windows. You can use it to get weather forecasts, set reminders, tell you jokes, send email, find files, search the Internet and so on. To know more about  Cortana Check this and this 
I hate Cortana So much specially when its activated by it self to know The pros and cons of Cortana check this.
There is many way to stop and disable Cortana, but there is two ways worked fine with me and I want to shared with you

  1. Form Local Group Policy Editor
  •  Right Click on start menu choice Run or use shortcut win+r, write GPedit.msc Navigate to Local Computer Policy -> Computer Configuration -> Administrative Templates -> Windows Components -> Search.
  • In the right pane, double click on policy named Allow Cortana.
  • Select the Disabled radio button. 
 


  1. Open Task Manager and have it show More details. Right click on Cortana and select Open file location.
Task Manager
Now find the Cortana folder, right click it, and select Rename. I would recommend just adding ".bak" to the end of the folder name so you can find it easily if you want to restore it back to it's original status.
Rename
If you attempt to rename, it will tell you that the folder is in use.
Folder In Use
This is when you want to go back to Task Manager, right click on Cortana, and select End task.
End task
Right after the task ends, switch back to the Folder In Use window and click Try Again. The folder should be renamed and the Cortana task will not start again.