Windows

[Oracle] Allowing Oracle ADI users to switch database with a batch file

Some ADI users will need to switch between database for different purposes. However, this would not be easy without having to change the network config files for Oracle.

I had created a batch file to allow users to change database by first preparing all the database registry, network config (tnsnames.ora and sqlnet.ora) and put them under C:\ADI. I had grant normal users the rights to change those files.

Below is the batch:

@ECHO off
cls
:start
ECHO.
ECHO ADI Menu.
ECHO 1. PRD 8000
ECHO 2. TST 8001
ECHO 3. UAT 8002
ECHO 4. DEV 8003
ECHO 5. PTH 8018
ECHO 6. Exit

set choice=
set /p choice=Please select database from the above list and press enter:
REM if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto PRD8000
if '%choice%'=='2' goto TST8001
if '%choice%'=='3' goto UAT8002
if '%choice%'=='4' goto DEV8003
if '%choice%'=='5' goto PTH8018
if '%choice%'=='6' goto Exit
REM set choice
ECHO "%choice%" is not a valid input, Please try again.
pause
ECHO.
cls
goto start

:PRD8000
ECHO PRD8000 selected.
del /q C:\orant\NET80\ADMIN\sqlnet.ora
del /q C:\orant\NET80\ADMIN\tnsnames.ora
del /q C:\orant\NETWORK\ADMIN\sqlnet.ora
del /q C:\orant\NETWORK\ADMIN\tnsnames.ora

copy C:\ADI\tnsnames.ora_Prod8000 C:\orant\NETWORK\ADMIN\
copy C:\ADI\tnsnames.ora_Prod8000 C:\orant\NET80\ADMIN\

ren C:\orant\NETWORK\ADMIN\tnsnames.ora_Prod8000 tnsnames.ora
ren C:\orant\NET80\ADMIN\tnsnames.ora_Prod8000 tnsnames.ora

regedit /s c:\adi\prd8000.reg
goto end

:TST8001
ECHO TST8001 selected.
del /q C:\orant\NET80\ADMIN\sqlnet.ora
del /q C:\orant\NET80\ADMIN\tnsnames.ora
del /q C:\orant\NETWORK\ADMIN\sqlnet.ora
del /q C:\orant\NETWORK\ADMIN\tnsnames.ora

copy C:\ADI\tnsnames.ora_tst8001 C:\orant\NETWORK\ADMIN\
copy C:\ADI\tnsnames.ora_tst8001 C:\orant\NET80\ADMIN\

ren C:\orant\NETWORK\ADMIN\tnsnames.ora_tst8001 tnsnames.ora
ren C:\orant\NET80\ADMIN\tnsnames.ora_tst8001 tnsnames.ora

regedit /s c:\adi\tst8001.reg
goto end

:UAT8002
ECHO UAT8002 selected.
del /q C:\orant\NET80\ADMIN\sqlnet.ora
del /q C:\orant\NET80\ADMIN\tnsnames.ora
del /q C:\orant\NETWORK\ADMIN\sqlnet.ora
del /q C:\orant\NETWORK\ADMIN\tnsnames.ora

copy C:\ADI\tnsnames.ora_uat8002 C:\orant\NETWORK\ADMIN\
copy C:\ADI\tnsnames.ora_uat8002 C:\orant\NET80\ADMIN\

ren C:\orant\NETWORK\ADMIN\tnsnames.ora_uat8002 tnsnames.ora
ren C:\orant\NET80\ADMIN\tnsnames.ora_uat8002 tnsnames.ora

regedit /s c:\adi\uat8002.reg

goto end

:DEV8003
ECHO DEV8003 selected.
del /q C:\orant\NET80\ADMIN\sqlnet.ora
del /q C:\orant\NET80\ADMIN\tnsnames.ora
del /q C:\orant\NETWORK\ADMIN\sqlnet.ora
del /q C:\orant\NETWORK\ADMIN\tnsnames.ora

copy C:\ADI\tnsnames.ora_dev8003 C:\orant\NETWORK\ADMIN\
copy C:\ADI\tnsnames.ora_dev8003 C:\orant\NET80\ADMIN\

ren C:\orant\NETWORK\ADMIN\tnsnames.ora_dev8003 tnsnames.ora
ren C:\orant\NET80\ADMIN\tnsnames.ora_dev8003 tnsnames.ora

regedit /s c:\adi\dev8003.reg
goto end

:PTH8018
ECHO PTH8018 selected.
del /q C:\orant\NET80\ADMIN\sqlnet.ora
del /q C:\orant\NET80\ADMIN\tnsnames.ora
del /q C:\orant\NETWORK\ADMIN\sqlnet.ora
del /q C:\orant\NETWORK\ADMIN\tnsnames.ora

copy C:\ADI\tnsnames.ora_pth8018 C:\orant\NETWORK\ADMIN\
copy C:\ADI\tnsnames.ora_pth8018 C:\orant\NET80\ADMIN\

ren C:\orant\NETWORK\ADMIN\tnsnames.ora_pth8018 tnsnames.ora
ren C:\orant\NET80\ADMIN\tnsnames.ora_pth8018 tnsnames.ora

regedit /s c:\adi\pth8018.reg
goto end

:Cancel
exit

:end
start C:\orant\BIN\GLDI9032.EXE

 

 

 

[Outlook] Search Results can’t be moved or Categorized and Categories column isn’t shown

When using Outlook 2016 with an Exchange account, setting flag or category on search result may not work. To fix the issue, please create and following key:

Key: HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Options\Search
Value name: DisableServerAssistedSearch
Value type: REG_DWORD
Value: 1

More details can be found in this article.

Add/Delete printers with Windows built-in script PRNMNGR.vbs

As mentioned earlier in previous article, there is a built-in script in Windows 7 for printer management.

To add a printer:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -ac -p "\\server\printer"

To set default printer:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -t -p "\\server\printer"

To remove a printer:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -d -p "\\server\printer"

To remove a printer from the printer server:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -d -p "printer" -s server

For more info, just type:

 cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs

Or you could read the documentation by Microsoft:

https://technet.microsoft.com/en-us/library/bb490974.aspx

 

WOL doesn’t work on Windows 10

Installed Windows 10 on HP Z600 with latest BIOS. WOL doesn’t work no matter what configuration changes I made.

Starts working again once I format and install Openelec.

I believe it’s not a good timing for Windows 10 yet, many people are claiming the same for Windows 10. It’s somehow related to how Windows 10 deal with the power saving.

Silent install Tibco Spotfire 7.0.0 desktop client

The method described in this article does not work on version 7.0.0, with a little investigation with Orca I found out that it uses INSTALLDIRUSER instead of INSTALLDIR variable to define the install path.

Therefore, in my case, I used the following parameters to install silently:

setup-7.0.0.exe /s /v/qn /V”/l*v logfile.txt ALLUSERS=1 SERVERURL=http://spotfireserver:port/ INSTALLDIRUSER=\”C:\Program Files\Tibco\SpotFire7.0.0\””

Silent installation of Google Pinyin Chinese input

To install Google Pinyin silently, you can use the following parameter, no admin rights required:

GooglePinyinInstaller.exe -s

This is tested on version 2.7 on a Windows 7 machine, however,  it will not show in Programs and Features (Add/Remove program). To add an entry to it, you need the below registry:

 

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GooglePinyin2]
“DisplayName”=”谷歌拼音输入法 2.7”
“UninstallString”=”C:\\Program Files (x86)\\Google\\Google Pinyin 2\\GooglePinyinUninstaller.exe -s”
“DisplayIcon”=”C:\\Windows\\SysWOW64\\GooglePinyin2.ime”
“Publisher”=”Google Inc.”

 

[PowerShell] Script Lets You Check Patches’ Status

I was asked to modify the script posted at http://windowsitpro.com/scripting/powershell-script-lets-you-check-patches-status

such that given a list of computers, check if any PC has missed a KB. So here it is:

$erroractionpreference = “SilentlyContinue”
clear-host

if ($args.count -lt 2)
{
write-host -f blue “Syntax Error : Must have 2 parameters.”
write-host -f blue “Eg powershell.exe \kb.ps1 ”
break
}

$filename = $args[0]
$computer = $args[1]
$kbs = get-content $filename
$kbTotal = 0
$kbNotFound = 0
write-host -f green “Checking on”$computer

foreach ($kb in $kbs)
{
$global:kbTotal++
$strQuery = “select * from win32_pingstatus where address = ‘” + $computer + “‘”
$wmi = get-wmiobject -query $strQuery
if ($wmi.statuscode -eq 0)
{
$checkkb = get-wmiobject Win32_QuickFixEngineering -computer $computer | where-object {$_.hotfixid -eq $kb} | select-object hotfixid, description
# BEGIN CALLOUT A

if ($checkkb.hotfixid -eq $kb)
{write-host -f green $kb “`t” $checkkb.description “`r”}
else
{write-host -f red $kb “`t” “Patch not found.” “`r”
$global:kbNotFound++
}
}
else
{write-host $computer “`t” “Ping failed.” “`r”}
# END CALLOUT A
}

if ($global:kbNotFound -eq 0)
{write-host -ForegroundColor Green $global:kbNotFound “KBs missing out of”$global:kbTotal “required”}
else
{write-host -ForegroundColor Red $global:kbNotFound “KBs missing out of”$global:kbTotal “required”}

Below is the the version where it outputs to a text file, I had modified it to output to c:\temp instead:

# Function : to check for kbxxxx patches on remote pc
# This version redirects the output to a text file.

$erroractionpreference = “SilentlyContinue”

cls
if ($args.count -ne 2)
{
write-host -f blue “Syntax Error : Must have 2 parameters.”
write-host -f blue “Eg powershell.exe \kb.ps1 ”
break
}

$filename = $args[0]
$computer = $args[1]
$kbs = get-content $filename

write-host -f green “Checking on”$computer
“Checking on” +$computer | out-file c:\temp\results.txt -append

foreach ($kb in $kbs)
{

$strQuery = “select * from win32_pingstatus where address = ‘” + $computer + “‘”
$wmi = gwmi -query $strQuery

if ($wmi.statuscode -eq 0)
{
$checkkb = gwmi Win32_QuickFixEngineering -computer $computer | where {$_.hotfixid -eq $kb} | `
select-object hotfixid, description

if ($checkkb.hotfixid -eq $kb)
{
write-host -f green $kb “`t” $checkkb.description “`r”
$kb + ” ” + $checkkb.description | out-file c:\temp\results.txt -append
}

else
{
write-host -f red $kb “`t” “Patch not found.” “`r”
$kb + ” patch not found” | out-file c:\temp\results.txt -append
}

}
else
{
write-host $computer “`t” “Ping fail.” “`r”
$computer + ” ping fail”| out-file c:\temp\results.txt -append
}

}

Disable SCCM by removing registry

Below are the commands needed to remove the necessary registry to disable SCCM and enable Windows Update:

reg delete HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate /f
net stop wuauserv
timeout 10
net start wuauserv

Cantonese on Android, Apple, and Microsoft Products

Very interesting topic about Cantonese and let us know where to get Cantonese input for different OS.

Hong Kong and Cantonese

I find it interesting that even though we tend to deny Cantonese the same (if any) prestige that we give Mandarin in the world by not teaching it in schools or universities, calling it a “dialect,” and overall advocating the more “proper” use of Mandarin for economic upward mobility and business, quite prominent companies include Cantonese language features to attract consumers, perhaps indicative of the lucrativeness of the Cantonese-speaking market that predominantly resides in Hong Kong.

For one, Android products include Google voice typing using Cantonese, specifically labeled “粵語 (香港),” alongside Mandarin features for China and Taiwan. And while I don’t think Android includes a Cantonese language keyboard feature, one can use the free HKIME application to type using Cantonese romanization (I’m not sure if it’s Jyutping – it’s called “Canton Pinyin” on the keyboard), Cangjie, stroke, among others. There’s another application, Cantonese keyboard, that some reviews say works…

View original post 708 more words