Technology
Launch SSH/putty from a URL
So,
you have a bunch of SSH sessions and you want to be able to launch them from a URL?
Well in order to do that you need a “handler” that will take in the SSH url and pass the command to putty
I found this post on stackoverflow that does exactly what I need
basically, you create a handler that will call a powershell command, the command will parse the url and launch putty
1 2 3 4 5 6 7 8 9 10 11 12 |
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\ssh] @="URL:SSH Protocol" "URL Protocol"="" [HKEY_CLASSES_ROOT\ssh\shell] [HKEY_CLASSES_ROOT\ssh\shell\open] [HKEY_CLASSES_ROOT\ssh\shell\open\command] @="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -Command \"$uri = [System.Uri]'%l';&\"${env:ProgramFiles(x86)}\\PuTTY\\putty.exe\" -P $uri.Port $uri.GetComponents([System.UriComponents]::UserInfo -bor [System.UriComponents]::Host, [System.UriFormat]::UriEscaped)\"" |
Thank you Martin for your awesome hack!!
Sharepoint 2010 Profile Sync Stuck On “Starting”
I had an issue with my Profile Synchronization service. After a server reboot it wouldn’t start again.
What I did to fix it was:
- Stop the User Profile Service and the User Profile Synchronization Service from the Central Administration Page
- If it is stuck on starting, you need to use the SharePoint 2010 Management Shell / Powershell to stop it
1Get-SpServiceInstance
Now copy the GUID from the “User Profile Synchronization Service”
1Stop-SpServiceinstance <GUID>
You also need to delete any Setup Jobs still running
12$timerjob = Get-SPTimerJob | where {$_.Name -eq "ProfileSynchronizationSetupJob"}$timerjob.Delete() - Go to Central Administration -> Application Management -> Manage Service Applications and delete “User Profile Service Application”
- Recreated the “User Profile Service Application”
- Delete all the FIM Certificates in the MMC->Computer->Personal and MMC->Computer->Enterprise certificate stores
- Perform an IISReset
- Restart the User Profile Service and the User Profile Synchronization Service, they should now start cleanly
Solving the “java.lang.SecurityException: The provider self-integrity check failed” error with Crystal Reports Server 2011 on JBOSS 5.1
If you are deploying Crystal 2011 to JBOSS 5.1 you may get the following errors in your log
- java.io.IOException: Child not found MobileBIService/WEB-INF/lib/bcm.jar
- Could not initialize class com.businessobjects.bcm.BCM
- java.lang.SecurityException: The provider self-integrity check failed
The culprit to these two errors are the OpenSearch.WAR File and the MobileBIService.WAR File
There are a few workarounds listed in this JBOSS JIRA Ticket JBAS-7882.
The easiest solution to me was to just explode the two war files, and the errors went away
How to Change PlaceHolder values in Crystal Reports Server 2011 / BI4
I needed to update the placeholders in crystal reports server 2011 for the FRS services. In CRS2008 I changed them using placeholders.bat, but the current PlaceHolders.bat file is outdated and meant to be used on XI 3 I think. So first I had to take it upon myself to make placeholder.bat compatible with CRS2011 / BI4. (Because WE ALL KNOW SAP wont do it for us)
Here is the modified placeholders.bat script:
1 2 3 4 5 6 7 8 9 |
@echo off FOR /F "tokens=2* delims= " %%A IN ('Reg QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Suite XI 4.0\Config Manager" /v INSTALLDIR') DO SET BOHOME=%%B\ FOR /F "tokens=2* delims= " %%A IN ('Reg QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Suite XI 4.0\Config Manager" /v JAVAHOMEDIR') DO SET JAVA_HOME=%%B\.. FOR /F "tokens=2* delims= " %%A IN ('Reg QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Suite XI 4.0\Config Manager" /v SHAREDCLASSESINSTALLDIR') DO SET BOCLASSDIR=%%B\ FOR /F "tokens=2* delims= " %%A IN ('Reg QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Suite XI 4.0\default" /v BINDIR') DO SET PATH=%%B\jdk\bin;%PATH% set CLASSPATH=.;%BOCLASSDIR%\* java Placeholders %1 %2 %3 %4 %5 %6 %7 %8 %9 |
Combine it with Placeholders.class from the placeholders.zip (SAP Note 1449399) and now you can change any pleaceholder
First lets test out the command
1 |
Placeholders.bat -cms @CMSCluster -pass $$password -allsia -display |
Now Lets update the 2 FRS Placeholders DefaultInputFRSDir and DefaultOutputFRSDir
1 |
Placeholders.bat -cms @CMSCluster -pass $$password -allsia -update DefaultInputFRSDir \\mycustompath\FileStore\Input |
1 |
Placeholders.bat -cms @CMSCluster -pass $$password -allsia -update DefaultOutputFRSDir \\mycustompath\FileStore\Output |
and the after
Enjoy!!
Running the Citrix License Server Virtual Appliance in Vmware
I thought it was cool when I found that Citrix had a Citrix License Virtual Appliance.
To me, it was one less server to “manage” plus it would allow add it to my VMWare environment to make it highly available. Well, i was disappointed to find out it was only for xenserver, so I set out to use it with VMware (because I dont like when a company tells me i cant)
This is going to take some time, and you will need to download a few things, so pay attention
You need:
Citrix License Server XVA from the Citrix Website
VirtualBox 4 from Oracle
CentOS 5 x64 Live CD ISO
XenServer ISO
How to Proceed:
Create a VM in VMWare and install XenServer (give it at least a 30GB disk)
Note the new IP of your XenServer and connect to it via your browser and follow the link to Install XenCenter
From XenCenter Load up the Citrix Licensing XVA file
Boot the VM once and then shut it down (dont configure it)
Export the License server again to an XVA (C:\Temp)
Right now you are wondering WHY we are going back to XVA, let me explain. Citrix “mangled” the header of the XVA file so only XenServer could import it. If you try to convert it directly with XenConvert you will get an error.
Install and Run XenConvert
Choose to Convert from “Xen Virtual Appliance” to “Open Virtualization Package” and just accept all the default options
When the Converter finishes, you will be left with a VHD and an OVF file.
Install and Run VirtualBox
Create a new VM called “Citrix License Server Virtual Appliance”
Choose Redhat 64-bit as the OS
Give it 512mb of RAM
Remove / Disable the Sound Card
Choose the previously created VHD (from XenConvert) as the harddisk
Boot it once, you will get an error “Error 13: Invalid or unsupported executable format”
Shut down the machine and from the menu choose “export appliance” and export it as an “OVF” <–THIS IS IMPORTANT
Open up the newly created OVF XML file with your trust text editor and change the line that read
Note: I take ABSOLUTELY NO CREDIT FOR THE FOLLOWING, this was a post from an excellent blog called IT Secure Net and you can find the post here
<vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType>
with
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
and also
<Item>
<rasd:Address>0</rasd:Address>
<rasd:Caption>sataController0</rasd:Caption>
<rasd:Description>SATA Controller</rasd:Description>
<rasd:ElementName>sataController0</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:ResourceSubType>AHCI</rasd:ResourceSubType>
<rasd:ResourceType>20</rasd:ResourceType>
</Item>
to
<Item>
<rasd:Address>0</rasd:Address>
<rasd:Caption>SCSIController</rasd:Caption>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSIController</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</Item>
Now deploy the OVF to your ESX Server. You will get a couple of warnings about the OS and asking you to continue, just hit YES
Once it finishes, start up your new VM, which should bring you back to the familiar “Error 13: Invalid or unsupported executable format” we saw earlier.
This whole time we spent it just converting the Appliance. Now we need to get it to run on VMWare.
Find that CentOS 5 X64 and Attach it to the new VM
Boot the VM and when prompted hit F5 “Linux Rescue”
Enable the Network Interface when prompted (you will need Internet Access)
From the shell, run the following commands
1 2 3 4 5 6 7 8 9 10 11 |
chroot /mnt/sysimage echo "nameserver 4.2.2.2" >> /etc/resolv.conf yum install kernel (say yes to the kernel and all its dependencies) grub-install --root-directory=/ /dev/sda --recheck echo "-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT" >> vi /etc/sysconfig/iptables echo "3:2345:respawn:/sbin/agetty -L 9600 tty1 vt102" >> /etc/inittab |
now view your /boot/grub/menu.lst, if it already has an entry for the new kernel (2.6.18-348.6.1.el5) then you are good to go, otherwise lets use grubby to add it
1 |
grubby --add-kernel="/boot/vmlinuz-2.6.18-348.6.1.el5 --initrd="/boot/initrd-2.6.18-348.6.1.el5.img" --title="CentOS (2.6.18-348.6.1.el5)" --copy-default --make-default |
Now reboot (dont forget to disconnect the CentOS 5 ISO) and configure your new license server and Enjoy
If for whatever reason you get the “Error 13” screen again, re-load the linux rescue and delete the old entries for the el5xen kernel and img from the /boot/grub/grub.conf file
There you go Citrix, I just did your work for you!!
Combining Multiple Shares into One DFS Folder (With PowerShell)
I had the need to combine multiple Windows shares into one DFS Folder / Location. Anyone that uses DFS knows that you can either create links to the top level share or its sub folder and that there is no way to automatically combines all the folders together
Creating links to all the sub folders is fine if you have 10 or 20, but what if you have 350 links to create. Such as in my case, I had the need to create links to all the “Users” folders for every one of my departments.
Doing this would allow me to point all my scripts / group policies to one single location, without putting all the user folders on one server.
Here is the script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
<# User Home Script This cript will scan all the file server shares specified in the "UserShare" array It will then create a link for every folder in that share under the designated DFS path > $UserShare = "\\winsrv1\Users","\\winsrv2\Users","\\winsrv3\Users" $DFSRoot = "\\pinchii.com\data" $DFSPath = "$DFSRoot\userhome" function addUsers { foreach ($share in $UserShare) { #Echo $share Get-ChildItem $share | where {$_.psiscontainer} | Select-Object $_.Name | foreach {If (Test-Path $DFSpath\$_) {Echo "Skipping $_. Already Exists"} Else {Echo "Adding $_ From $Share"; dfsutil link add $DFSpath\$_ $share\$_}} } } function purgeUsers { #[xml]$xml = Get-Content c:\root.xml dfsutil root export \\ps.lan\data $evn:temp\root.xml [xml]$xml = Get-Content $evn:temp\root.xml foreach ($link in $xml.Root.Link) { #$Link.Name #$Link.Target.State #$Link.Target.'#Text' If ($Link.Target."#Text".contains("\\null") -eq $false) { If (Test-Path $Link.Target."#Text") { Echo "Skipping $($Link.Name). Target Is Good. $DFSPath" } Else { Echo "Removing $($Link.Target.'#Text') From $DFSpath"; dfsutil link remove $DFSRoot\$($Link.Name) } } } } #this is past the functions, now we process command line arguments of the script and use those to know which process to run $a = $args[0] #check if argument is null and assign a blank string if it is if (!$a) {$a = ""} switch ($a.ToLower()) { "/addusers" {addUsers} "/purgeusers" {purgeUsers} default {Echo "`r`nInvalid Argument.`n================`n `nIt must be one of the following: `n/addusers `n/purgeusers`n"} } |
That’s it. This script will scan the shares, take every sub folder and add a link to the sub folder under the DFS folder I designated. For my purpose, I used it to combine user folders, and its been working great in production for months now.
You can use this script to combine any folder, except for 1 catch. Last I checked, DFS has a limit of 5000 links per “name space”, so if you are worried about approaching that limitation, you can always create a separate namespace specifically for the user folders or whatever other folders you are planning to combine.
NetScaler VPX and the “ssl_error_no_cypher_overlap”
If your management gui is not able to use SSL, or In order to fix the ssl_error_no_cypher_overlap error with the netscaler VPX
access your netscaler via http://yournsip/
Go to “Load Balancing” -> Services -> Internal Services
Open up the nshttps-127.0.0.1-443 service
Click over to the SSL Settings tab and click on the Ciphers button
Remove all ciphers and add “DEFAULT” under the “Configured Ciphers Group”
Do the same exact procedure for the nsrpcs-127.0.0.1-3008
After you click on, Hit the Save button, and try to connect to your NSIP with https
Garbled Text in ADB Shell
When you “ADB Shell” into your android Device and perform an “ls” command, and you are seeing a log of gabled text with some numbers and some arrows, don’t freak out, your device is not broken. Those numbers and arrows are meant to be instructions for your console app to display the different folders with colors
no you don’t have to live with it, just tell your console not to display the color information anymore, just simply type
1 |
alias ls="ls --color=never" |
and then you should be ok when you issue a “ls” command
Wake-On-Lan Shell Script for Tomato
I needed a way to wake up my server when I was away. And since I run DD-WRT, I Wrote a WOL Script for it. You can read more about it here
Some people emailed me or asked via the comments section if I would create a version for Tomato, which is another popular firmware for routers
Now that I upgraded my main router to a Bufallo WZR-HP-AG300H, I had my old and trusty Buffalo WHR-G54S to play with, so I loaded Tomato on it, and decided to modify my WOL scrit for it.
Enjoy!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#!/bin/sh #Wake-On-Lan Script for Tomato #by Pinchii - Aug, 2012 #http://pinchii.com/home/2012/08/wake-on-lan-shell-script-for-tomato/ nvram get dhcpd_static >/tmp/static.hosts HOSTNAME=$1 WOL=/usr/bin/ether-wake HOSTS=/tmp/static.hosts ETH=br0 #Check if the user provided a host name to the script #otherwise exit with an error if [ -z "$HOSTNAME" ]; then echo Missing Parameter echo ----------------- echo "You must specify a hostname. Usage: $0 <hostname>" exit 1 fi #I commented out most of the section bellow, because for Tomato the broadcast ad #Now Find The Broadcast Address of the current configuration BCAST=`ifconfig $ETH | awk '/Bcast/ {split ($3,A,":"); print A[2]}'` #if [ -z "$BCAST" ]; then #echo Unable to Determine Broadcast Address for Interface $ETH #fi #Since we have the Broadcast Address, lets try to find the Server/Host and Wake #it up #SERVER=`grep ",$HOSTNAME," $HOSTS` SERVER=`grep "<$HOSTNAME>" $HOSTS` if [ -n "$SERVER" ]; then #MAC=`echo $SERVER | awk -F[,=] '{print $2}'` MAC=`echo $SERVER | awk -F"<" '{print $1}'` echo Sendind Wakeup to Network on $BCAST to $HOSTNAME at Address $MAC $WOL -b $MAC else echo Error echo ------------------- echo "Unable to find "$HOSTNAME" in hosts file $HOSTS." exit 1 fi |
Once you get the script into your router (copy and paste into VI or WinSCP), to use it, all you have to do is type “./wol.sh <servername> and the script will handle the rest
Don’t forget to “chmod +x” the script first
This script dumps out the “dhcpd_static” nvram variable into “/tmp/static.hosts”, so if you have a DHCP reservation for your server like I do, it should be included in this file as a “static” ip adress, along with the MAC address, which is what you really need for WOL to work
Broke SSH in DD-WRT After Upgrade – This is How to Fix it
I recently updated my version of DD-WRT from 14xxx to the latest and greatest 18946
I know that they recommend you do the 30/30/30 reset, but you know what, I didn’t want to lose all my settings.
What I found when the router restarted, is that everything worked fine, Except for SSH
It seems that as of version 17xxx the guys are DD-WRT switched from OpenSSH to Dropbear. No big deal really, exept the SSH keys are not compatible with each other, thus preventing SSH from running.
To fix SSH:
- Enable Telnet
- Telnet into your router and run the following commands:
- cd /tmp/root/.shh/
- rm authorized_keys
- rm ssh_host_dss_key
- rm ssh_host_rsa_key
- nvram unset sshd_rsa_host_key
- nvram commit
- reboot
Once the Router Restarts, SSH should be working, and when you try to login, you will get a prompt to accept the new Key Generated by DropBear
Don’t Forget to Disable Telnet