SharePoint 2013 Prerequisite Installer Failing – Unable to Install IIS

Literally been banging my head against the table, wall and floor over this one. I kept getting the error you can see below when trying to run the SharePoint 2013 prerequisite installer:

After a LOT of research and trying a bunch of different “solutions”, all completely failing to fix the issue, I look into the error log file. I know, right. What a nerd!? There is referenced trying to use a “ServerManagerCMD.exe” in the system32 directory. I looked and could only find a “ServerManager.exe”.

“Well shit”, I thought to myself. Microsoft is bloody amazing and SharePoint is the cherry on top of the cake.

So to fix this, I copied the “ServerManager.exe” file and renamed it to be “ServerManagerCMD.exe”:

And surely enough, after closing the installer and retrying, everything went swimmingly!

Enjoy!

Change ownCloud User Home in MYSQL

So I recently created a new ownCloud 10 server to get away from ownCloud 9. This meant creating a new CentOS 7 VM bladybladyblah…

One thing that caught me out, among many to do with ownCloud, was that the original user created during the setup process couldn’t save or view files after I had reconfigured the home directory to be more secure.

After looking in the MYSQL database, I saw that the original user’s home directory had not been updated to match the new path. To check this I used the following commands and looked for the home column:

USE owncloud;
SELECT * FROM oc_accounts;

After those commands, I updated the users home setting by using the following command:

UPDATE oc_accounts SET home="/new/dir/username" WHERE user_id="user";

Nice simple fix for an issue that was driving me up the wall.

Hope you enjoy!

Making External VFAT Drive Writable on Linux

 

Prerequisites: 

I would install nano, this is a text editor on Linux which is MUCH easier to use for beginners than vi. You can do this by using “sudo apt-get install nano” or “yum install nano” depending on your distribution of Linux.


First we will need to find where in /dev your drive is being displayed. You can do this by running:

lsblk

which will display all the drives currently connected to your Linux machine. The easiest way to see which drive you want is to check the size of the drive. For example, I have connected a 500GB hard drive so when I run “lsblk” I get the following:

lsblk

From this screenshot you can already see that I have mounted the drive partition I require, which in my case is sda3.

Now you need to create a directory in the mnt directory as this is were you should mount drive in Linux to keep things tidy. You can do this by using:

sudo mkdir /mnt/library

I have called by directory “library” but you can call it whatever you want.

Now we need to configure this in the fstab file which basically tells the system what to do with connected drives once the system starts.

You can open the fstab file by using:

sudo nano /etc/fstab

This should give you something similar to below:

fstab 1

Now go to the bottom of the file and add something similar to the one I have added, you can see this below:

fstab

Just for reference the line I have added is:

“/dev/sda3         /mnt/library          vfat          users,umask=00          0          0”

Make sure to check the directory locations as you might have called your something else and your drive label might be different.

You can now check in your /mnt/library directory and you should see that your drive has been mounted and you can delete and add new files to the location.

Enjoy!

Linux New Users Form

Following on from my recent upload on Linux scripting, I have yet again created a BASH script to make my Linux’ing life easier. This is also my second script created in BASH so I guess i’ve accomplished something by not running for the hills…

What I needed was a script to make creating FTP users easier on my CentOS box. Below is a list of things I needed the script to accomplish:

  • Get a username from a user prompt
  • Get a Description from a user prompt
  • Create the new user
  • Change the users password
  • Add the username to /etc/vsftpd.userlist
  • Add the username to /etc/vsftpd/chroot_list
  • Make a directory in the home folder of the user called “ftp”
  • Change the permissions and ownership on this directory
  • Make a directory in the “ftp” folder called “files”
  • Change the permissions and ownership on this directory
  • Ask the user to create a share or not
  • Get a share name from user prompt
  • Make a directory in the users “files” folder with the same name as the share name
  • Mount the share to the “files” directory
  • Ask if the new user is the owner of the share
    • if so then change the ownershipa and permissions on the share
    • if not then just change the permissions on the share
  • Finish

Here is my script for achieving these goals:

#!/bin/bash
#Creating new FTP users

##Gathering Variables
echo "Enter a username"
read Username

echo "Enter a description"
read Description

useradd -m -c "$Description" -s /bin/bash $Username

passwd $Username

echo "$Username" | tee -a /etc/vsftpd.userlist
echo "$Username" | tee -a /etc/vsftpd/chroot_list

mkdir /home/$Username/ftp
chown nobody:nobody /home/$Username/ftp
chmod a-w /home/$Username/ftp

mkdir /home/$Username/ftp/files
chown $Username:$Username /home/$Username/ftp/files
chmod 0700 /home/$Username/ftp/files

read -p "Create a share? [yn]: " CreateShare
if [[ $CreateShare = y ]] ; then

 read -p "Enter a share name: " ShareName

 mkdir /home/$Username/ftp/files/$ShareName
 mkdir /home/shares/$ShareName
 mount --bind /home/shares/$ShareName /home/$Username/ftp/files/$ShareName
elif [[ $CreateShare = n ]] ; then
 read -p "Enter the pre-existing share name: " ShareName
 mkdir /home/$Username/ftp/files/$ShareName
 if [ -d /home/shares/$ShareName ] ; then
  echo "Mounting share"
  mount --bind /home/shares/$ShareName /home/$Username/ftp/files/$ShareName
 else
  echo "Cannot find the share name : $ShareName"
 fi
else
 echo "Not a y or n"
fi

read -p "Is $Username the owner of this share? [yn]: " ShareOwner
if [[ $ShareOwner = y ]] ; then
 chown $Username:$Username /home/shares/$ShareName
 chmod 0775 /home/shares/$ShareName
else
 echo "$Username is not the owner of $ShareName"
 chmod 0775 /home/shares/$ShareName
fi

echo "Finished creating user : $Username" * Insert your code here

Hopefully somebody gains something from this, probably not though. Enjoy!

Windows Favourites Folder Spelt “Favorites”

Something a little off topic today. Windows naming is weird… that’s it. I found this when trying to run a RoboCopy script to back-up my favourites “Internet Explorer” (Award winning, grama nominated, amazing browser).

This is what my script for RoboCopy used to look like:

robocopy C:\Users\harwoodm\Favourites d:\robocopy\Favourites /MIR /R:1 /W:5 /FFT /LOG:"C:\users\harwoodm\robocopy logs\favourites.txt" /TEE /NP /NFL /NDL

I was getting Error 2, path not found.

Little did I know that, even though in the Explorer it’s spelt “Favourites” the path has it as “Favorites”

EVIDENCE!!!

Favorites

Does this make any sense to you, doesn’t to me…

Anway, hope this helped. Enjoy!

Custom PowerShell Environment and Modules

To add custom PowerShell modules to your PowerShell environment, you first need to find out where you PowerShell profile is. You can do this by typing in:

$profile

into a PowerShell prompt. It should look like the following:

$profile

Now we need to test if the path actually exists. To do this type:

Test-Path $profile

If the prompt returns $true, your good. If it returns $false then you will need to run the following command:

New-Item -Path $profile -Itemtype file -Force

Now that is done we should be able to open the file in notepad. You can either browse to it following the path in $profile or type in:

notepad $profile

This should open a blank text file:

$profile empty

In here is where you specify PowerShell to look for custom modules and can even add text to the PowerShell prompt. For example, if I had the following to the notepad, it will also be displayed when I open a new PowerShell window:

custom $profile (write-host)

But we can also use this to load custom functions into our PowerShell environment. To do this, got to the $profile location, here you should find a folder called “Scripts”

Scripts folder

Go into the folder and create a new folder, mine is called “autoload”

autoload

Here is where you create your custom functions/ scripts. For example, here is what I have:

list-example

where each file contains a single function.

Now that were done with the easy part. You want to go back into your $profile notepad and add the following in order for PowerShell to load your customer functions:

$psdir="C:\users\YOU!\documents\windowspowershell\scripts\YOURSCRIPTFILENAME"

get-childitem "${psdir}\*.ps1" | %{.$_}

You can see from my file. I have multiple files to make for easier sorting of my functions. I also have a custom start screen to list all of my current commands so that I don’t forget them. You can see that below:

$profile example

Just so that you can see, this is what my PowerShell prompts look like:

My prompt

For a list on verbs and commands that you can use, visit the Microsoft website and forums. You DON’T want to use verbs or commands that are used else where or that have a unique purpose. Choose verbs that are different. Good luck. Enjoy!