Developer OneNote

Emma's OneNote for Microsoft Windows, Office and Programming

Category: Script

Install PowerShell From Command Line

22 July, 2010 | Category: Script, Windows

To install PowerShell on Windows Server 2008 R2 or Hyper-V Server 2008 R2, following features needs to be installed.

  1. NetFx2-ServerCore
  2. NetFx3-ServerCore
  3. MicrosoftWindowsPowerShell

Because Powershell is built on DotNet framework, DotNet 2.0 and 3.5  has to be installed prior to PowerShell installation.

To install PowerShell from command line, run following from elevated command prompt

DISM.exe /online /enable-feature /featurename:NetFx2-ServerCore DISM.exe /online /enable-feature /featurename:NetFx3-ServerCore DISM.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShell

Or run following command if it’s an 64bit machine

DISM.exe /online /enable-feature /featurename:NetFx2-ServerCore-WOW64 
DISM.exe /online /enable-feature /featurename:NetFx3-ServerCore-WOW64 
DISM.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShell-WOW64 

Enable DotNet 3.5 from command line

4 July, 2010 | Category: Script, Windows

To enable DotNet 3.5 from command line, run following from elevated command prompt

dism.exe /online /enable-feature /featurename:NetFx3

Synchronizing two batch files

19 January, 2010 | Category: Productivity Tools, Script

This useful command lets you wait for signals from other command windows or even across the network.

waitfor.exe is in windows\system32 directory.

The simple case for the tool is in one command window you do a “waitfor foobar” and it’ll block until in another window you do a “waitfor /SI foobar”.

Disable standby/sleep

10 January, 2010 | Category: Script, Tips and Tricks

powercfg.exe is a windows built in tool to config power management. powercfg.exe is a command line utility, it’s easy to integrate powercfg.exe into scripts.

Turn hibernation off

powercfg -hibernate OFF

Set the power configuration to High Performance

powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

Set the absentia power scheme (the scheme used when no one is logged in)

powercfg.exe -setabsentia 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

Enable/disable the built-in administrator account

9 January, 2010 | Category: Script, Tips and Tricks

Enabling the built-in administrator account:

net user administrator /active:yes

Disabling the built-in administrator account:

net user administrator /active:no

Note: Must use an elevated command prompt for this command to work.

Shutdown or reboot the computer

5 January, 2010 | Category: Script, Tips and Tricks

Shut down

shutdown /s /t 0

Reboot

shutdown /r /t 0

Launch Regional and Language Settings

5 January, 2010 | Category: Script, Tips and Tricks

Bring up the Regional and Language Settings dialog box

control intl.cpl