Showing posts with label command line util. Show all posts
Showing posts with label command line util. Show all posts

Saturday, 8 March 2014

Auto load PowerShell Window in Server Core

When working with a server core I like to have a PowerShell window open. Here is a quick way to do it.

You could just type PowerShell in the cmd window to turn it into a PowerShell window or type Start PowerShell to open a separate PowerShell window.

To have it there waiting for you:

  1. From cmd prompt run Regedit
  2. Navigate to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
  3. Add string Value called PowerShell with value cmd.exe /k %windir%\system32\WindowsPowerShell\v1.0\powershell.exe.

Alternatively use the PowerShell Command

New-ItemProperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\run -Name PowerShell -Value C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -Type string

Wednesday, 15 May 2013

Messing about with NetSH AdvFirewall

Reset Firewall to Default

If you are going to mess about with your firewall the first thing you want to know is how to reset it to default

netsh advfirewall reset

Export/Import Settings

The second thing you should know is probably the last thing you would have though about. If you are going to mess around with an already successfully configured firewall then you may want to save the current settings and reimport them.

netsh advfirewall export "c:\wfconfig.wfw" 
netsh advfirewall import "c:\wfconfig.wfw"

It’s not a bad idea if you are messing about with NetSH in general to export the configuration. Not all “learning” is done with easily revertible test VMs … most of the important lesson we learn tend to be on live systems.

Firewall Off & On Test

If I switch the firewall off will this work … NO … better switch it back on then.

netsh advfirewall set allprofiles state off
netsh advfirewall set allprofiles state on

Useful WMIC Queries

WMI using the command line, WMIC is a utility that allows you to interact with WMI from a WMI-aware command-line shell.

Here are a couple of useful links

TechNet: Ask the Performance Team Blog

WMIC - The Windows secret weapon

Thursday, 25 April 2013

Remote Desktop printing add additional drivers

I run Hyper-V with a mix of 32bit/64bit operating systems and would like to print from any of the remote session to my local printer.

My ancient HP LaserJet 1200 has the default Windows 7 32bit driver installed but I cannot get the additional 64bit driver to install.

I seem to remember a similar situations in the past with a network printer where the resolution was the printer had a different name in the 32 bit inf than the 64 bit. I hacked the 64 bit inf file and ensured the names matched exactly … with success.

Did not want to go through that again and thought that I would try the HP Universal Printing PCL 5 drivers installed from the command line with PNPUTIL.EXE … why … never used it and wanted to try it.

  • Downloaded both versions of the driver from HP
  • Installed the 32 bit driver from an elevated command prompt
  • pnputil –a c:\<path>\*.inf
  • and did the same with the 64 bit
  • opened the printer properties, advanced tab and switched the driver to the HP Universal Printer PCL5

image

As I did not intend blogging this I forget whether I had to go to the share tab and add the additional drivers or whether it was smart enough to find it for itself.

image

Painless and I can now print from 64bit VMs

Friday, 4 December 2009

Exchange 2007 unable to mount mailbox store

Brought my SBS 2008 test server back online after giving it a two month break.
Could not connect outlook clients to exchange.
Exchange services running
Fould mailbox store was dismounted and would not mount.
Checked store all seemed in order clean shutdown.

Did some checks with ESEUTIL everything ok.

Checked the web common solution for number of issues was to move the log files.

Created a folders and moved all the log and chk files to it.
Mailbox store mounted Outlook clients connecting.
Away to do a backup know its working

Here are some links to Information Store Tools
Exchange Server Database Utility Guide
Using the Exchange tools ISINTEG and ESEUTIL to Ensure the Health of your Information Store

Monday, 30 November 2009

Installing wbadmin command line tools on member server

By default only the Windows Server Backup GUI is installed on Windows 2008 member servers. If you try to use wbadmin at the command line the GUI version will start.

To install the command line tools
On the server
  1. Start button open Server Manager
  2. Right click on Server Manager(server name)
  3. Select Add features
  4. Expand Windows Server Backup features
  5. The GUI should already be selected, Select Command line tools.
  6. Once the installation has completed you should now be able to use wbadmin from the command line.
    No need to restart the server.

Tuesday, 17 November 2009

Windows 2008 Server Core enabling remote management

This is part of a series of bloggs written while installing Windows 2008 SBS Premium as VMs on Hyper-V.


Remote management of Windows Server 2008 Core from  a Windows Vista Workstation.
Microsoft recomendation is not to have the windows core/hyper-v server in the same domain as the Virtual Machines (VMs) so I leave the hyper-v server and managment workstation in a workgroup. The Vista workstation must be at least Service Pack 1.


If you may wish to create a seperate management domain for core server and managment workstation rember to do so before setting the firewall rules. Firewall rules are lost when the server is moved from a workgroup to domain.


Reboots are required after some steps ... still to update the documentation.


Configuring firewall rules on Core and Vista
netsh advfirewall firewall set rule group="Remote Administration" new enable=yes
netsh advfirewall firewall set rule group="Remote Volume Management" new enable=yes


last command needs to be run on Vista workstation as well make certain that the command prompt has been elevated to admin.


sc config vds start= auto (note the space is reqired between = and auto)
net start vds


Hyper-V server and client in same workgroup or DCOM Remote Access enabled
On the client run the following
cmdkey /add:targetname  /user:user_name  /password:user_password
cmdkey /delete:targetname
(cmdkey not avaliable on XP but windows 2003 version can be installed ... will blog this later)

DCOM Remote Access
If the hyper-v server is in a different workgroup or domain that the client ... setting DCOM Remote Access permission on the client.
  • Run DCOMCNFG
  • In the Component Services dialog box, expand Component Services, expand Computers, and then right-click My Computer and click Properties.
  • In the My Computer Properties dialog box, click the COM Security tab.
  • Under Access Permissions, click Edit Limits.
  • In the Access Permission dialog box, select ANONYMOUS LOGON name in the Group or user names box. In the Allow column under Permissions for User, select Remote Access, and then click OK.

Windows 2008 Server Core Local Settings

Managing Server Core Local Settings From Command Line
Windows Server 2008 Core installation does not include the graphical user interface (GUI) and can only managed locally from a command prompt.

start /w
  • net
  • netdom
  • netsh
    • Netsh advfirewall firewall set rule group=”” new enable=yes
  • ocsetup
  • pnputil
  • sc
  • shutdown
  • taskkill
  • wevtutil
  • wbadmin
  • wmic