Powershell: QuickCMD: Configure IP Address in Windows Server 2012 R2

For the IP address of 10.0.0.5, with a gateway of 10.0.0.1, and 24 bits for the subnet mask (255.255.255.0):

$IPAddress=”10.0.0.5”

$Gateway=”10.0.0.1”

$Prefix=24

Get-NetAdapter | NEW-NetIPAddress -IPAddress $IPAddress -Defaultgateway $Gateway -Prefixlength $Prefix

Advertisements

Powershell : QuickCMD : Import data from a .TXT file

Reading a Text File

Get-Content c:\scripts\test.txt

Import Text file content to a var

$var = Get-Content c:\scripts\test.txt

Using pipeline to pass the data to another cmdlet

Get-Content c:\scripts\test.txt | Foreach-Object {Get-Wmiobject -computername $_ win32_bios}

Count the number of lines of the array created from the Text file

Get-Content c:\scripts\test.txt | Measure-Object

Import only the first/last 5 lines from the Text file

Get-Content c:\scripts\test.txt -totalcount 5
Get-Content c:\scripts\test.txt | Select-Object -last 5

Get-Content Aliases

  • gc
  • type
  • cat

http://technet.microsoft.com/en-us/library/ee176843.aspx

Exchange : Exchange 2003/2007/2010 mailbox database white space

To check the amount of white space, admins can use one of these two options:

1. The Get-MailboxDatabase cmdlet will return the available space for new mailboxes

Get-MailboxDatabase <DB Name> -Status | fl Name,Avail*

 command:

Output from the Get-MailboxDatabase <DB Name> -Status | fl Name,Avail* command

2. To get a completely accurate representation of white space in the mailbox database, admins should use the ESEUTIL /MS command:

Output from the ESEUTIL/MS command

http://searchexchange.techtarget.com/answer/All-about-Exchange-mailbox-database-white-space