Backup Script Info /Surapong Naowasate v 1.0
Home path
=========
c:\vmware\
Folder:
- Script
- Hostlist
- Log-backup
File:
sc_xxx.ps1 - Script For backup
hl_xxx.txt - Host List For backup
VMware-Backup-xxx.log - Log Backup
Daily Backup info file path
===========================
c:\vmware\Script\Daily\sc_daily.ps1
c:\vmware\Hostlist\hl_daily.txt
c:\vmware\Log-backup\Daily\VMware-Backup-daily-$backup_date-$backup_timestamp
Weekly Backup info file path
===========================
c:\vmware\Script\Weekly\sc_weekly.ps1
c:\vmware\Hostlist\hl_weekly.txt
c:\vmware\Log-backup\Weekly\VMware-Backup-weekly-$backup_date-$backup_timestamp
Monthly Backup info file path
===========================
c:\vmware\Script\Monthly\sc_monthly.ps1
c:\vmware\Hostlist\hl_monthly.txt
c:\vmware\Log-backup\Monthly\VMware-Backup-Monthly-$backup_date-$backup_timestamp
EXP:Daily Backup Script
-------------------------------
Add-PSSnapin VMware.VimAutomation.Core
#Call VMware library
$VM = Get-Content c:\vmware\Hostlist\hl_daily.txt
#get hosting name for backup
$BackupvCenter = "vCenter.domain.local"
#set vCenter Name for connected to Backup
$BackupHost = "esxiHost.domain.local"
#Destination Host for Stored backup VMs ( by clone VMs)
$backupDate = Get-Date -Format yyyyMMdd-HHmm
#set date format
$backupDatastore = "VMware-Backup-Storage"
#set DataStore for backup
Connect-VIServer -Server $BackupvCenter -User backupuser@domain.local -Password backupuserpassword
#Connet to vCenter
$VM_LOG = 'c:\vmware\Log-backup\Daily\VMware-Backup-daily-'+$backupDate+'.log'
#set log path and backup filename
foreach ($line in $VM) {
Get-VM -Server $BackupvCenter | where { $_.PowerState -like 'PoweredOn' -and $_.name -like $line } | select name, vmhost, guestid, numcpu,memorymb | Out-File $VM_LOG -Append
#get information Guest VMs for backup
$VM_TMP = 'Backup-VMs-daily-'+$backupDate+'-'+$line
#set newname Guest VMs for backup
New-VM -Name $VM_TMP -VM $line -VMHost $BackupHost -Datastore $backupDatastore -Location Daily | Out-File $VM_LOG -Append
#clone VMs to backup Storage
$last7day = (get-date (get-date).AddDays(-7) -Format yyyyMMdd)
$VM_OLD_BACKUP = 'Backup-VMs-daily-'+$last7day+'-0000-'+$line
Remove-VM $VM_OLD_BACKUP -DeleteFromDisk -Confirm:$false#remove VM from Datastore Last 7 day (dailybackup)
}
---------------------------------------
ADD to Windows TASK Schedule
============================
- Create Task
- Set name of Schedule JOB
- Set Account for run backup schedule (DOMAIN\backupuser)
- Set Run whether user is logged on or not
- Create Trigger for job ex. daily, weekly, monthly
- Set Action for job ex. run powershell
- start a program 'powershell'
- add argument '-file c:\vmware\script\powershell_script'
- start in directory 'c:\vmware\script'
- Click OK , Scheduled Task will asked for password of backup user (DOMAIN\backupuser)
Monday, June 13, 2016
Friday, June 10, 2016
Run Vmware PowerCLI on Windows Schedule Task
There 2 way to Doing:
1. Load Vmware LIB
Add-PSSnapin Vmware.VimAutomation.Core
in vmware powershell script (*.ps1)
2. exec in windows schedule task
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI" $ "Parh_to_PowerShell_Script"
1. Load Vmware LIB
Add-PSSnapin Vmware.VimAutomation.Core
in vmware powershell script (*.ps1)
2. exec in windows schedule task
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI" $ "Parh_to_PowerShell_Script"
Thursday, June 9, 2016
ORA-00845: MEMORY_TARGET not supported on this system
:Manual Mount tmpfs
mount -t tmpfs shmfs -o size=12g /dev/shm
:Auto Mount on fstab
tmpfs /dev/shm tmpfs size=12g 0 0
Size of tmpfs = MemorySize x 2
mount -t tmpfs shmfs -o size=12g /dev/shm
:Auto Mount on fstab
tmpfs /dev/shm tmpfs size=12g 0 0
Size of tmpfs = MemorySize x 2
Wednesday, April 27, 2016
Tuesday, April 26, 2016
Add static route gateway persistent
add static route gateway persistent
:windows
route -p add dest_network mask dest_netmask gateway
ex:
route -p add 192.168.1.0 mask 255.255.255.0 10.10.10.1
:solaris 10
route -p -net dest_network/24 -gateway gateway
ex:
route -p add 192.168.1.0/24 -gateway 10.10.10.1
:OracleLinux 6.5
# cd /etc/sysconfig/network-scripts
# cat route-eth2
# echo ‘10.11.18.0/24 via 10.10.18.4′ >> /etc/sysconfig/network-scripts/route-eth0
:windows
route -p add dest_network mask dest_netmask gateway
ex:
route -p add 192.168.1.0 mask 255.255.255.0 10.10.10.1
:solaris 10
route -p -net dest_network/24 -gateway gateway
ex:
route -p add 192.168.1.0/24 -gateway 10.10.10.1
:OracleLinux 6.5
# cd /etc/sysconfig/network-scripts
# cat route-eth2
# echo ‘10.11.18.0/24 via 10.10.18.4′ >> /etc/sysconfig/network-scripts/route-eth0
Tuesday, April 19, 2016
Clear Alert log /Trace file in Oracle 11g using adrci
adrci command line
:ON Database SID (alert log & trace file)
show home
set homepath diag/rdbms/db_sid/db_sid
show alert -tail
show tracefile -tail
PURGE -AGE 7200 -TYPE ALERT;
:ON Listener log (alertlog & tracefile)
show home
set home diag/tnslsnr/db_hostname/listener
show alert -tail
show tracefile -tail
PURGE -AGE 7200 -TYPE ALERT;
-age in sec
:ON Database SID (alert log & trace file)
show home
set homepath diag/rdbms/db_sid/db_sid
show alert -tail
show tracefile -tail
PURGE -AGE 7200 -TYPE ALERT;
:ON Listener log (alertlog & tracefile)
show home
set home diag/tnslsnr/db_hostname/listener
show alert -tail
show tracefile -tail
PURGE -AGE 7200 -TYPE ALERT;
-age in sec
lock account/unlock account Office 365 user
To block a user account:
Set-MsolUser –UserPrincipalName user@yourdomain –blockcredential $true
To unlock a user accout:
Set-MsolUser -UserPrincipalName user@yourdomain –blockcredential $false
Set-MsolUser –UserPrincipalName user@yourdomain –blockcredential $true
To unlock a user accout:
Set-MsolUser -UserPrincipalName user@yourdomain –blockcredential $false
Subscribe to:
Posts (Atom)
ALCATEL 6900
write memory copy running certified reload from working no rollback-timeout
-
grant execute on utl_http to wc grant execute on dbms_lock to wc; BEGIN DBMS_NETWORK_ACL_ADMIN.create_acl ( acl => ...
-
:system view system-view or sys :show all config dis current-configuration :create vlan vlan vlan_number :show ip interface ...
-
SET LLDP System NAME: system name ALL-Uplink system location SIAM-FL11 SHOW LLDP Configure: show lldp config or show lldp local-syste...