October 15, 2016

Cách dùng VEEAM Backup v9 sao lưu vCenter Appliance từ ESXi Host cũ và khôi phục sang ESXi Host khác

Sau đây tôi giới thiệu 1 bài Labs thực hành về phương pháp sao lưu/ khôi phục hệ thống VMware vSphere vCenter Server Appliance 6 thông qua công cụ Back/Restore chuyên nghiệp – số 1 Thế giới VEEAM Backup Free version 9.
– Cách dùng VEEAM Backup Free v9 backup vCenter Appliance 6 từ 1 ESXi Host cũ và khôi phục sang 1 ESXi Host khác
(Trường hợp: do không có Share Storage/SAN chung cho các ESXi Host, chỉ có 1 máy ảo VM có hệ điều hành Opensource/MS Server như: Openfiler/FreeNAS hoặc WIndows Server 2012 làm Software NFS)
Các bước chuẩn bị cho hệ thống VEEAM Backup:
Bước 1. Cách cấu hình VEEAM Backup Free v9
  • Tải bản ISO cài đặt VEEAM Backup Free v9
  • Cài hệ thống VEEAM Backup Free v9 xin tham khảo:
  • Cấu hình VEEAM Backup Free v9 trên  3 mô hình chính:
    • Cài trên 1 VM windows 2012 R2
    • Cài trên 1 Hyper-V và có windows 2008 R2/ W2K12/W2K12R2.
    • Cài .Net framework 4.5, SQL Express2013 Sp1
Bước 2. Cách viết script cho VEEAM Backup trên PowerShell v2

– Nội dung file VEEAMBackup.ps1  script:
##################################################################
#                   User Defined Variables
##################################################################
# Names of VMs to backup separated by comma (Mandatory). For instance, $VMNames = “VM1”,”VM2”
$VMNames = “VCVA60”
# Name of vCenter or standalone host VMs to backup reside on (Mandatory)
$HostName = “10.10.11.80”
# Directory that VM backups should go to (Mandatory; for instance, C:\Backup)
$Directory = “E:\Backup_K2”
#Optionally, you can change compression level and desired retention, disable VMware quiescence, enable encryption or even notification settings:
# Desired compression level (Optional; Possible values: 0 – None, 4 – Dedupe-friendly, 5 – Optimal, 6 – High, 9 – Extreme)
$CompressionLevel = “5”
# Quiesce VM when taking snapshot (Optional; VMware Tools or Hyper-V Integration Components are required for this in the guest OS; Possible values: $True/$False)
$EnableQuiescence = $True
# Protect resulting backup with encryption key (Optional; $True/$False)
$EnableEncryption = $False
# Encryption Key (Optional; path to a secure string)
$EncryptionKey = “”
# Retention settings (Optional; by default, VeeamZIP files are not removed and kept in the specified location for an indefinite period of time.
# Possible values: Never, Tonight, TomorrowNight, In3days, In1Week, In2Weeks, In1Month)
$Retention = “Never”
#If you like to get an email report once the backup is completed, you should additionally fill out the following notification settings.
##################################################################
# Notification Settings
##################################################################
# Enable notification (Optional)
$EnableNotification = $True
# Email SMTP server
$SMTPServer = “”
# Email FROM
$EmailFrom = “”
# Email TO
$EmailTo = “”
# Email subject
$EmailSubject = “”
##################################################################
#                   Email formatting
##################################################################
$style = “<style>BODY{font-family: Arial; font-size: 10pt;}”
$style = $style + “TABLE{border: 1px solid black; border-collapse: collapse;}”
$style = $style + “TH{border: 1px solid black; background: #dddddd; padding: 5px; }”
$style = $style + “TD{border: 1px solid black; padding: 5px; }”
$style = $style + “</style>”
##################################################################
#                   End User Defined Variables
##################################################################
#################### DO NOT MODIFY PAST THIS LINE ################
Asnp VeeamPSSnapin
$Server = Get-VBRServer -name $HostName
$MesssagyBody = @()
foreach ($VMName in $VMNames)
{
  $VM = Find-VBRViEntity -Name $VMName -Server $Server
  If ($EnableEncryption)
  {
    $EncryptionKey = Add-VBREncryptionKey -Password (cat $EncryptionKey | ConvertTo-SecureString)
    $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention -EncryptionKey $EncryptionKey
  }
  Else
  {
    $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention
  }
  If ($EnableNotification)
  {
    $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
    $FailedSessions =  $TaskSessions | where {$_.status -eq “EWarning” -or $_.Status -eq “EFailed”}
  if ($FailedSessions -ne $Null)
  {
    $MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object @{n=”Name”;e={($_.name).Substring(0, $_.name.LastIndexOf(“(“))}} ,@{n=”Start Time”;e={$_.CreationTime}},@{n=”End Time”;e={$_.EndTime}},Result,@{n=”Details”;e={$FailedSessions.Title}})
  }
  Else
  {
    $MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object @{n=”Name”;e={($_.name).Substring(0, $_.name.LastIndexOf(“(“))}} ,@{n=”Start Time”;e={$_.CreationTime}},@{n=”End Time”;e={$_.EndTime}},Result,@{n=”Details”;e={($TaskSessions | sort creationtime -Descending | select -first 1).Title}})
  }
  } 
}
If ($EnableNotification)
{
$Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
$Message.Subject = $EmailSubject
$Message.IsBodyHTML = $True
$message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
$SMTP = New-Object Net.Mail.SmtpClient($SMTPServer)
$SMTP.Send($Message)
}
Bước 3. Cấu hình PowerShell V2 cho phép chạy, read/write/executive trên máy chủ Windows chạy bản VEEAM Backup Free v9.
Lưu ý khi lần đầu cài Microsft PowerShell và chạy trên máy PC mới:
  • Gõ lệnh trên màn PowerShell / cmdlet / cmdDOS :
Get-PSSnapin
  • Gõ lệnh kiểm tra quyền chạy  WinRM kết nối tới  Office 365 (O365):
net start winrm
winrm get winrm/config/client/auth
  • Gõ lệnh cấu hình lại quyền chạy winrm (nếu kết quả báo: Basic=false):
winrm set winrm/config/client/auth @{Basic=”true”}
  • Một số trường hợp đặc biệt, máy PC của bạn đang join domain và  bị Global domain ngăn cản bằng các Policy domain hãy gõ lệnh sau để thiết lập quyền kết nối và điều khiển Office 365 bằng PowerShell:
Set-ExecutionPolicy RemoteSigned
Set-ExecutionPolicy Unrestricted
  • Nếu là bị  GPO hạn chế  quyền restricted policy hãy gõ lệnh sau:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy unrestricted -force
  • Thêm vào đó 4 dòng lệnh sau:
Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy unrestricted -force
Set-ExecutionPolicy -Scope MachinePolicy -ExecutionPolicy unrestricted -force


Set-ExecutionPolicy -Scope UserPolicy -ExecutionPolicy unrestricted -force
Set-ExecutionPolicy -Scope Process -ExecutionPolicy unrestricted -force

Bước 4. Cấu hình Task Schedule trên Windows > Administrator Tool cho phép chạy Script theo lịch trình thời gian (onTime, on daily, on weekly, on Monthly…)
image
image
image
image
Bước 5. Kiểm tra history kết quả backup của VEEAM Backup Free v9
image

Phần khôi phục lại máy chủ ảo VCVA  trên một ESXi Host khác, sau khi đã backup VEEAM v9 thành công.
Bước 1.
– Mở VEEAM Backup chọn Menu HOME > chọn nút Restore
image
Chọn thư mục và tìm tới file đã backup máy chủ ảo VCVA
image
Chọn bản đã backup gần nhất để restore
image
Chọn kiểu Restore Entire VM
image
image
Chọn vị trí ESXi Host khác để restore VM
image
Chọn từ Host mặc định cũ: 10.10.11.80  và chuyển sang Host khác: 10.10.11.70
image
Đã chọn sang Host khác.
image
Cuối cùng là phần Datastore để chứa máy chủ ảo VCVA cần khôi phục, bạn sẽ phải trỏ tới 1 trong các vùng lưu trữ như: DAS, SSD, Local storage, SAN, NAS, Share Storage mà có thể kết nối thông với ESXi Host vừa trỏ tới.
image
Lưu ý: vùng trống để chứa và vận hành máy chủ ảo VCVA có kích thước tối thiểu:
(114,3 Gb +  8Gb (swap file for memory ~ 8Gram/1 VM)
Bước 2. Kiểm tra kết quả khôi phục:
image

Bước 3. Kiểm tra máy chủ ảo VCVA:
– Bật máy ảo vCenter Server 6 sau khi đã khôi phuc thành công từ VEEAM Backup
image
– Mở console vCenter Appliance 6 và kiểm tra tình trạng chạy ổn định
image
– Mở IE/FF kiểm tra web vsphere client
image

Chúc các bạn thành công với việc bảo vệ máy chủ vCenter Server Appliance an toàn.
nguồn: https://thangletoan.wordpress.com/2016/02/17/cch-dng-veeam-backup-v9-sao-luu-vcenter-appliance-tu-esxi-host-cu-v-khi-phuc-sang-esxi-host-khc/
http://www.slideshare.net/laonap166/cch-dng-veeam-backup-v9-sao-lu-v-center-appliance-t-es-xi-host-c-v-khi-phc-sang-esxi-host

October 14, 2016

Cấu hình CA cho SSL trên máy chủ RemoteFX


image
image
2. Các bước thực hiện:
Bước 1. IIS 8
image
Bước 2.  Cấu hình Common name
image
Bước 3.  Cấu hình mã hóa RSA
image
Bước 4. Lưu fie txt hoặc req
image
Bước 5. Mở Server Manager trên máy chủ AD Server 2008 R2
image
Bước 6. Kiểm tra cấu hình CA server
image
Bước 7.  Dùng cmd chạy lệnh xác thực và tạo file chữ ký (đay là do lỗi phân quyền tự động duyệt chữ ký số)
image
certreq.exe
Bước 8. Mở lại Windows 2012, mở cmd và gõ lệnh mmc > chọn Certificate Authenticate:
image
Bước 9. Chọn mục Personal > chọn chữ ký số đã ký > bấm phải chuột chọn menu : Export…
image
Bước 10. Cài mật khẩu
image
Bước 11. Cấu hình chữ ký số cho các dịch vụ
image
Bước 12. Sau khi cài các chũ ký số
chúng ta có thể tiến hành publish các Application qua RD Broker Publish service bình thường
image
Bước cuối:
Chạy trình duyệt test, phần lớn trường hợp ở đây bị lỗi, cách tốt nhất là khởi động lại máy chủ Windows 2012 và kiểm tra màn Dashboard xem có dịch vụ nào không chạy (báo đỏ)
hãy vào các mục service lỗi đó và bấm chuột phải chọn Start để các dịch vụ đó chạy lên hết, rồi hẵng vào IE/Chrome/FF và test lại trang RemoteFX
image

Chúc các bạn thành công  !
nguồn: https://thangletoan.wordpress.com/2012/11/20/phan-chua-duoc-cng-bo-cau-hnh-ca-cho-ssl-trn-my-chu-remotefx/
http://www.slideshare.net/laonap166/cu-hnh-ca-cho-ssl-trn-my-ch-remotefx

October 3, 2016

VMware vSphere: Install, Configure, Manage



VMware vSphere: Install, Configure, Manage
  • This hands-on training course explores installation, configuration, and management of VMware vSphere, which consists of VMware ESXi and VMware vCenter Server.
  • This course is based on versions of ESXi 5 and vCenter Server 5.
  • Completion of this course satisfies the prerequisite for taking the VMware Certified Professional 5 exam.
  • Build your own cloud infrastructure in your datacenter and remote sites on VMware vSphere, the world’s leading server virtualization platform.

Reference: http://openlabvn.com/wordpress/?p=254

September 29, 2016

Delegating Control of an Organizational Unit in Windows server 2008


How can I increase the number of PCs a specific user can join to a domain?

  1. Open the ADSI Edit MMC snap-in and connect to the Domain Naming Context.
  2. Right-click on the domainDNS object for the domain you want to change and select Properties.
  3. Edit the ms-DS-MachineAccountQuota attribute and enter the new quota value.
  4. Click OK twice.





September 28, 2016

GPO - How to Detect Who Unlocked a User Account in Active Directory

1. Run gpedit.msc → Create a new GPO → Edit it: Go to "Computer Configuration" → Policies → Windows Settings → Security Settings → Advanced Audit Policy Configuration → Audit Policies → Account Management:
  • Audit User Account Management → Define → Success and Failures.
2. Go to Event Log → Define:
  • Maximum security log size to 4gb
  • Retention method for security log to "Overwrite events as needed".
3. Link the new GPO: Go to "Group Policy Management" → Right-click domain or OU → Choose Link an Existing GPO → Choose the GPO that you created.
4. Force the group policy update: In "Group Policy Management" right click on the defined OU → Click "Group Policy Update".
5. Open Event Viewer → Search security log for event ID 4767 (A user account was unlocked).



Reference: http://social.technet.microsoft.com/wiki/contents/articles/32929.how-to-detect-who-unlocked-a-user-account-in-active-directory.aspx

September 27, 2016

Active Directory User Logon Time and Date

This post explains where to look for user logon events in the event viewer and how we can write out logon events to a text file with a simple script.
Domain Controller
To view AD user logon times, set ‘Audit Logon events’ to ‘Success’ in the Default Domain Controllers Policy. When a user logs on you will receive the Event ID 540 (2003) or Event ID 4624 (2008) in the security log of the logonserver used.
Server 2003
Event ID 540
Server 2008
EventID 4624 DC
Computer
Again, ‘Audit Logon events’ needs to be set to success, you can do this in the Default Domain Policy. When a user logs on you will receive the Event ID of 528 (XP) or Event ID 4624 (W7) in the security log of the local computer.
XP
Event ID 528
Windows 7
EventID 4624 W7
Write Logons to Text File
This is a nice method for quickly viewing and searching for a User logon event within a single text file. Create a logon script and apply this to all users in your domain.

@ECHO OFF
echo %logonserver% %username% %computername% %date% %time% >> \\server\share$\logon.txt
exit
This outputs the logonserver (server the user authenticated against), username, computername, date and time to a file called logon.txt. This method isn’t particularly secure, as users will need to have the permissions to write to the file, you can put it in a hidden share like I have done above which adds a slight level of security (by obscurity), but it’s something to be aware of.
Now you can open this single file and view all user logons. You could do the same for logoff if is you so desired.
Logon.txt
Brucey Bonus
If you’d like to view the ‘live update’ of this text file you can use an application called Tailme. This polls updates and adds them to a new line, quite handy if you are looking for a particular user to logon or if you want to see if that user has really restarted their machine…
You can set it to sit in the tray and a single click will bring it up. Here is the config I use.
Tailme Logon

Reference; https://blog.thesysadmins.co.uk/active-directory-user-logon-time-and-date-2.html

GPO - Adding Local intranet, Trusted Sites to Internet Explorer Using Group Policy

Create a new Group Policy Object and browse to 
User Settings -> Polices -> Administrative Templates -> Windows Components -> Internet Explorer -> Internet Control Panel -> Security Page.




Double click on the Site to Zone Assignment List, select enable and choose show to configure the options.

Note the numbering of the Security Zones:
1 for Local Intranet, 
2 for Trusted Sites, 
3 for Internet Zone 
4 for Restricted Sites Zone.

In this example I have added http://****.us to the Local intranet (1) and http://****.com to the Trusted sites (2).


clicking OK

You can run gpupdate /force to update GPO

Test on client,



Enjoyed!