2012-09-22

OB2D -- Learning (1) -- Installation

OB2D
http://www.phcno1.net/modules/tad_book3/page.php?tbdsn=292

How to use Virtualbox to build a ob2d server.
http://myip.tw/itsmw/index.php?title=Ob2d_2010

1. Download and install Oracle Virtualbox.
2. Settings for ob2d:
    OS:Linux
    Version:bebian
    RAM: 800MB
    HD:10GB

2012-09-15

Powershell -- 1st experience


#Set-ExecutionPolicy RemoteSigned
# VMware vSphere PowerCLI
if (((Get-PSSnapin -Name "VMware.VimAutomation.Core" -ErrorAction SilentlyContinue) -eq $null ) -and ((Get-PSSnapin–registered -Name "VMware.VimAutomation.Core") -ne $null))
{
   Write-Host "Adding VMware vSphere PowerCLI" -ForegroundColor Green
   Add-PSSnapin -name VMware.VimAutomation.Core
   ."C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"
}
$vmmodule = Get-PSSnapin -Name "VMware.VimAutomation.Core"
if (!$vmmodule) {
    [System.Reflection.Assembly]::LoadwithPartialName("System.windows.Forms")
    [System.windows.Forms.MessageBox]::Show("We dont got the VM powerCLI module.")
    exit
} else {
    echo "Module $vmmodule loaded successfully"
}
# SSH-Sessions Module load
$sshmodule = Get-Module -List 'SSH-Sessions'
if (!$sshmodule) {
    [System.Reflection.Assembly]::LoadwithPartialName("System.windows.Forms")
    [System.windows.Forms.MessageBox]::Show("We dont got the SSh-Sessions module.")
    exit
} else {
    Import-Module SSH-Sessions
    echo "Module $sshmodule loaded successfully"
}
#Connect to Vcenter
$Viserver = Connect-VIServer -Server 'IP' -User 'username' -Password 'password'
If (!$viserver) {
   [System.Reflection.Assembly]::LoadwithPartialName("System.windows.Forms")
   [System.windows.Forms.MessageBox]::Show("We dont connect to FTvcenter01.")
   exit
} else {
    echo "Connect to vcenter success"
}
Get-VM | Where-Object {$_.PowerState -eq "PoweredOn"} | Where-Object {$_.Name -ne "vcenter"} | Shutdown-VMGuest -Confirm:$false
Start-
#Get-VM
#Start-Sleep -s 600
#Get-VMHost | Stop-VMHost -Confirm:$false
#Get-VMHost
#Start-Sleep -s 300
#SSH to NetApp
$naserver = New-SshSession -ComputerName 'IP for 1st','IP for 2nd' -Username 'username' -Password 'password'
If (!$naserver) {
    [System.Reflection.Assembly]::LoadwithPartialName("System.windows.Forms")
    [System.windows.Forms.MessageBox]::Show("We dont connect to NetApp Controller.")
   exit
} else {
echo "Connect to NetApp Controller success"
}
exit 
#Invoke-Sshcommand -InvokeOnAll -Command 'halt -t 0 -f'
#Invoke-Sshcommand -InvokeOnAll -Command 'ifconfig -a'
#Remove-SshSession -RemoveAll

2012-09-06

SQLSchedule

To Backup SQL Express


Features:

  • Supports all versions of SQL Server 2000, 2005, and 2008
  • Supports unlimited SQL Server instances with an unlimited number of jobs.
  • Allows to easily schedule SQL Server maintenance tasks: backups, index rebuilds, integrity checks, etc.
  • Runs as Windows Service
  • Email notifications on job success and failure
  • And more...

http://www.lazycoding.com/products.aspx

LogParser -- (3)

logparser.exe -o:datagrid "SELECT TimeGenerated, Message FROM security WHERE EventID=680 AND Message LIKE 'username'"

PStool GUI

http://www.davitools.com/fepstools/documentation.aspx

2012-08-14

dsquery command

dsquery user -inactive 13 ==>list users have no login for 91 days.
dsquery user -stalepwd 180 ==>list users that the password had been used for 180 days.

2012-08-08

netsh command change IP address

netsh interface ip set address "Local Area Connection" static 192.168.0.1 255.255.255.0 192.168.0.254 1

netsh firewall set icmpsetting 8          => allow others to ping you
netsh firewall set icmpsetting 8 disable=> deny others to ping you