Archive
Create Active Directory users with Powershell
Scope
In my test environments I always have to create a couple of users to be able to do performance or functionality tests. Powershell really helps me with this task and I just want to archive this for later.
In the next few paragraphs I show you my method to create hundreds of test users on Windows Server 2012 with Powershell.
How to turn the GUI on and off on Windows Server 2012
There is a Windows Server edition which takes less attention that it deserves. This is the Microsoft Windows Server Core. Read more…
Postfix SASL Sender Statistics
In some cases we’d like to know, how much has been sent by our Postfix server on a per account basis.
Starting and keep running reboot persistent autossh on unix-like systems without root rights
Basic scenario
There are systems:
- - which can’t be accessed from the public internet. E.g. behind ipv4 NAT and DMZ isn’t an option.
- - which shouldn’t be access directly from the public internet. So firewal or other access control not suitable.
Solution
I wrote a simple shell script securing continuous running of autossh on unix-like systems.
The script is started by cron in every minutes, so no root rights is required. Allowed cron is necessary for your local user. I didn’t used @reboot because this crontab directive isn’t implemented on many Unix systems.
Autossh secures monitored ssh connection which opens a reversed ssh tunnel. If the connection losts it will be restarted by autossh.
The sshd is listening on the 22022 local port ot the host “sage”. So the my systems can be accessed only via local account of server “sage” which can be accessed from everywhere on the net.
The script
#!/bin/bash
#set -xHOST=”sage”
AUTOSSH_PATH=”/usr/bin/ssh”
export AUTOSSH_PATHAUTOSSH_PIDFILE=”/home/miam/bin/autossh.pid”
export AUTOSSH_PIDFILEPIDFILE=”$AUTOSSH_PIDFILE”
AUTOSSH_CMD=”/usr/bin/autossh”call_autossh ()
{
“$AUTOSSH_CMD” -M 22023 -N -R 22022:localhost:22 -f “$HOST”
}self_check ()
{
if [ -f "$PIDFILE" ]; then
PID=`cat “$PIDFILE”`
kill -0 $PID
if [ $? -eq 1 ]; then
return 1
else
return 0
fi
else
return 1
fi
}self_check
if [ $? -eq 1 ]; then
call_autossh
fi
The crontab entry
* * * * * /home/miam/bin/autossh.sh >> /home/miam/bin/autossh.log 2>&1
The repo
The code can be cloned from github:
Cache service – define memory allocation
well, at last i got the cmdlets to adjust the memory allocation for the chache service at a given machine:
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Unprovision()
Set-CacheHostConfig -Hostname <HostName> -cacheport 22233 -cachesize <Size in MB>
$serviceInstance.Provision()</i>
Installing nginx web server with php fpm and mysql on CentOS 6
In this article you will find a way to install NGINX web server and add php supporting.
PHP from version 5.3 got php-fpm included so now it’s relatively easy to get it work with nginx without additional scripting.
Check OCS/Lync enabled AD user with PowerShell
The security is important; working for a huge company sometimes causes problems. You get less right, because of the security. If you a normal user, and you would like to check if one of the user enabled for OCS without Admin rights or Universal Server Administrator right. A normal domain user can check it, because the AD readable for all AD users.
SharePoint workflow – How to check for empty date field
Recently I’ve had to work a lot with SharePoint workflows. During the implementations I am faced a lot of limitations of the SharePoint 2007. There’s a lot of situations when you need to apply workarounds, otherwise you are not able to achieve the goal. I would like to show you one of these limitations and of course I will present the quick and easy solution as well.
So, there was a workflow step when I had to check whether a date field is empty or not. According to the result I wanted to define different actions. Unfortunately in the Designer was no option for that as you can see below.
How to get the type of the HDD in PowerCLI
I would like to determine each VM HDD type. Is it thin or thick? I realized that this question is not a trivial.
Here are the commands, which gather the type of the disc.
$vm = Get-VM -name testsrv
$thin = (((($vm |get-view).config).Hardware).Device | where {$_.GetType().Name -eq "VirtualDisk"}).Backing.ThinProvisioned
if ( $thin )
{
Write-Host " Disk provisioning type: Thin"
}
Else
{
Write-Host " Disk provisioning type: Thick"
}
That’s all!
vCenter Server automated Inventory with PowerCLI
As you can see in my previous articles I created and filled in the Custom Attributes fields. The aim of the whole customization to store all data in the vCenter Server, easily do an automated inventory. The script not needs an SAP connection to gather the required information, because all data available in one information store.
