1

Code snippets : PostgreSQL : Add new superuser after PostgreSQL installation

-

After I instaled PostgreSQL on Amazon Linux AMI, first thing after database server was up and running I start thinking how to create user with administrative privileges, so I can access it using some management applications.

So, here is how to create superuser and set password, which will allow to access PostgreSQL using admin tools.

(more…)

0

Config snippets : Cisco: Reload command might be handy

-

Few times in the past when I was doing some changes on Cisco devices remotely I was a victim of myself, when wrong order of commands just disconnected me from device without ability to connect back. After few experiences of this kind I discovered magic command “reload” which can help and save the day.

So, when doing changes which can impact remote terminal connection to device it’s a good idea to initiate reload before making changes. In case something goes wrong device will reboot itself and will come back with previous configuration.

lab-r01#
lab-r01#reload in 15
Reload scheduled in 15 minutes by admin on console
Reload reason: Reload Command
Proceed with reload? [confirm]
lab-r01#
*Mar  1 03:11:11.659: %SYS-5-SCHEDULED_RELOAD: Reload requested for 03:26:09 UTC Fri Mar 1 2002 at 03:11:09 UTC Fri Mar 1 2002 by admin on console. Reload Reason: Reload Command.
lab-r01#

Once everything is configured and connectivity to device was not lost we can cancel reload process.

lab-r01#
lab-r01#reload cancel
lab-r01#

***
*** --- SHUTDOWN ABORTED ---
***

*Mar  1 03:11:19.415: %SYS-5-SCHEDULED_RELOAD_CANCELLED: Scheduled reload cancelled at 03:11:19 UTC Fri Mar 1 2002
lab-r01#

It is very helpful and can save time and rescue from trouble.

0

Code snippets : Unzip file in PowerShell

-

Recently I needed to unzip file from PowerShell script. Here is result what I did use to achieve that:

$archiveDir = "C:\Downloads"
$fileZip = $archiveDir + "\file.zip"
$shell=new-object -com shell.application
$zip = $shell.NameSpace($fileZip)
foreach ($item in $zip.items())
{
 $shell.NameSpace($archiveDir).CopyHere($item)
}
0

Tips & Tricks : Windows 10 & Windows Server 2016 reset on VMware ESX 6

-

Here is one from friend of mine, very skilled Senior IT Engineer, Tomasz Jagiello. Some bugs he identified while working with VMware ESX 6.

Symptoms

VM running Windows 10 (x64) as the Guest OS is automatically reset after some hours (roughly a day). Reoccurs daily.

The thread said it also applied to Windows Server 2016 VMs.

There is an unrecoverable error that cause the VMkernel to shut down / restart / crash the virtual machine.

VMware ESX unrecoverable error: (vcpu-0) NOT_REACHED bora/devices/ahci/ahci_user.c:1530

Check if you’re using a para-virtual SATA adapter in the settings of the VM.

 

Cause

There is a VMware bug where if the SATA adapter receives SMART communications on a non-SMART device the CPU bus locks up and ESX reboots the VM.

I was using SCSI for the VM disks and SATA for the VM CD-ROM.

 

Workaround

  1. Edit VM Hardware settings
    • Remove CD/ROM
    • OK
  2. Edit VM Hardware settings
    • Remove SATA Controller
    • OK
  3. Edit VM Hardware settings
    • Add CD/ROM
    • Change to IDE
    • Remove SATA Controller
    • OK
2

Apps : pass7decode : My First App for PlayBook

-

Finally it happened that I commited my first application for BlackBerry PlayBook. Application I’ve created decodes Type 7 password which is stored in Cisco devices configuration. It is not complicated application and has splash screen and one application screen, but it does what I expected this piece of software to do 🙂

Using this small app you can decode:

  • wireless keys fro Cisco access points,
  • RADIUS/TACACS shared secrets
  • NTP authentication keys
  • Enable passwords (NOT enable secrets, which are stored using MD5).

I hope to develop this application and add some more decryption abilities for Cisco devices (like group password from PCF file for example).

Here are screenshots of my first app 🙂

(more…)

0

Tips & Tricks : Yii framework update issue

-

When Yii-based project doesn’t want to update, there might be missing component.

Once you add one plugin everything goes back to normal.

[root@arb-srv-01 easyforms]# composer update
Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package found.
- yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package found.
- Installation request for yiisoft/yii2 2.0.7 -> satisfiable by yiisoft/yii2[2.0.7].

Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
[root@arb-srv-01 easyforms]# composer global require "fxp/composer-asset-plugin"

Changed current directory to /root/.config/composer
Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
Using version ^1.2 for fxp/composer-asset-plugin
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing fxp/composer-asset-plugin (v1.2.1)
Downloading: 100%

Writing lock file
Generating autoload files
[root@arb-srv-01 easyforms]#

Hope that helps.

1

Code snippets : VBscript : Change My Computer icon description

-

Script changes description of My Computer icon to display Computer: ComputerName

Can be very handy when troubleshooting computer remotely when we require user to tell us name of the computer user works on.
Script works on Windows 2000/XP/Vista/7.

(more…)

0

Tips & Tricks : How to add .NET Framework 3.51 to Windows 8 or Windows Server 2012

-

Unfortunately there is a problem when you try to add .Net Framework 3.51 to Windows Server 2012 using Server Manager. In order to fix that issue and get .Net Framework 3.51 installed (which is required by majority of applications and servers) issue following command from Command Prompt:

dism /online /enable-feature /all /featurename:NetFX3 /source:x:\sources\sxs

Please notice that x: in source parameter has to be replaced with appropriate drive letter for DVD with Windows Server 2012 installation files.

0

Tips & Tricks : CMD Batch parameters

-

Handful list of parameters possible to use in CMD scripts:

%~I         - expands %I removing any surrounding quotes ("")
%~fI        - expands %I to a fully qualified path name
%~dI        - expands %I to a drive letter only
%~pI        - expands %I to a path only
%~nI        - expands %I to a file name only
%~xI        - expands %I to a file extension only
%~sI        - expanded path contains short names only
%~aI        - expands %I to file attributes of file
%~tI        - expands %I to date/time of file
%~zI        - expands %I to size of file
%~$PATH:I   - searches the directories listed in the PATH
environment variable and expands %I to the
fully qualified name of the first one found.
If the environment variable name is not
defined or the file is not found by the
search, then this modifier expands to the
empty string

%~1         - expands %1 removing any surrounding quotes (")
%~f1        - expands %1 to a fully qualified path name
%~d1        - expands %1 to a drive letter only
%~p1        - expands %1 to a path only
%~n1        - expands %1 to a file name only
%~x1        - expands %1 to a file extension only
%~s1        - expanded path contains short names only
%~a1        - expands %1 to file attributes
%~t1        - expands %1 to date/time of file
%~z1        - expands %1 to size of file
%~$PATH:1   - searches the directories listed in the PATH
environment variable and expands %1 to the fully
qualified name of the first one found.  If the
environment variable name is not defined or the
file is not found by the search, then this
modifier expands to the empty string

%~dp1       - expands %1 to a drive letter and path only
%~nx1       - expands %1 to a file name and extension only
%~dp$PATH:1 - searches the directories listed in the PATH
environment variable for %1 and expands to the
drive letter and path of the first one found.
%~ftza1     - expands %1 to a DIR like output line

Very useful for automated software installations for example.

0

Cheat Sheet : Deprecated/Removed features in Windows Server 2012 R2

-
Windows Server 2012 Windows Server 2012 R2

Feature

Removed Deprecated Removed

Deprecated

AD FS v1 Web Agent x
AD FS in-place upgrade from AD FS 1.0 or “out of box” AD FS 2.0 x
AD FS support for “Resource Group” x
AD FS support for NT Token mode x
AD FS support for using AD LDS as an authentication store x
AD RMS license revocation x
AD RMS SDK x
Application Server role x
Built-in drivers for tape drives x
Cluster Automation Server COM API x (made optional) x (optional)
Cluster.exe command-line interface x (made optional) x (optional)
CertObj COM and InetInfo interfaces of the Web Server role x
Dcpromo.exe x
Dfscmd.exe x
Drivers for Jet Red RDBMS and ODBC x x
File Replication Service x
GAA_FLAG_INCLUDE_TUNNEL_BINDINGORDER flat in GetAdaptersAddresses x
Internet Information Service (IIS) 6.0 Manager x
Layered Service Providers x x
IscsiVirtualDiskSnapshot and associated WMI methods x
LPR/LPD protocol x x
Namespace for version 1.0 of WMI; WMIC (in WMI) x x
NDIS version 5.0, 5.1, and 5.2 APIs x x
Net DMA x
Network Access Protection (NAP) x
Network Information Service (NIS) and Tools (in RSAT) x
Nfsshare.exe x
NFSv2 support x
Oclist.exe x
ODBC support for 16- and 32-bit applications and drivers x x
ODBC/OLEDB support for Microsoft Oracle x
ODBC/OLEDB support for SQL beyond SQL Server 7 and SQL 2000 x x
Providers for SNMP, Win32_ServerFeature API, Active Directory, MSClus WMI1.0 (in WMI) x x
Recovery disk creation x
Remote Data Service x
Role Collector (Ceiprole.exe) and associated API x
SCSIport host-bus adapter x
Servermanagercmd.exe x x
SIS Limited API x
Slmgr.vbs options x
SMB 1.0 x
SMB.sys x
SMTP and associated management tools x x
SQLXMLX x x
Storage Explorer snap-in for MMC x
Storage Manager for SANs snap-in for MMC x
Subsystem for UNIX-based Applications x x
Support for 32-bit cluster resource DLLs x
Support for hardware drivers for XDDM x
Support for Microsoft SQL Server prior to 7.0 x
Support for native VGA via the PC/AT BIOS or UEFI CSM x
Support for Static VMQ x
Support for Token Rings x
Support for Visual Studio Analyzer 2003 over ODBC, OLEDB, and ADO x
System Image Backup (“Windows 7 File Recovery”) x
Telnet server x
VM Chimney (also called TCP Offload) (in Hyper-V) x
Windows Server 2003 domain and functional levels of Active Directory x
Windows Authorization Manager (AzMan) x x
Windows Help executable (WinHlp32.exe) x
Windows Identity Foundation 3.5 x
Windows Server Resource Manager x x
Winsock Direct x x
WMI root\virtualization namespace v1 (in Hyper-V) x x
XDR schema elements, XSl pattern feature of MSXML3 (in XML) x x