Category Archives: Computer

Give access to calendar based on the user is member of the group.

If you need to give auser access to users calendar, based on if there are member of an group, this is the way.
Start Exchange Management Shell

$users = Get-ADGroupMember [groupname] | select -ExpandProperty name
foreach ($user in $users) {
    $Mailbox = Get-Mailbox $user
	#The Calendar, is name "Kalender" in danish
	add-MailboxFolderPermission -identity “$($Mailbox.Name):\kalender” -AccessRights Editor -User [username]
	set-MailboxFolderPermission -identity “$($Mailbox.Name):\kalender” -AccessRights Editor -User [username]

	#English calendar
	add-MailboxFolderPermission -identity “$($Mailbox.Name):\calendar” -AccessRights Editor -User [username]
	set-MailboxFolderPermission -identity “$($Mailbox.Name):\calendar” -AccessRights Editor -User [username]
} 

New Equallogic warning mail: Free space is below threshold of 15 percent for pool PoolName. Default Snapshot Schedule will run with max-keep set to 1

After an upgrade of our Equallogic SAN to version 8 or later, i get this warning everyday:
Free space is below threshold of 15 percent for pool PoolName. Default Snapshot Schedule will run with max-keep set to 1.

I have 5% left on my SAN, and dosen’t used Snapshot at all on it. It only contain backup data. No needs to take snapshot of Backup data :).
So i turn of this warning message by SSH to the Grp Management IP, and logon with username, grpadmin and my password for this account.

After login I run this command: grpparams default-snapshot-sched disable

This will disabled the schedule running at 00:00, that checks for this 15% free space left.

Install Linux OSCore OS – With static network address

When you start the Linux OS – OSCore, from the bootable ISO file, you will just the a prompt.
To Install it, i following these steps

First we needed to be root

sudo su

Then we setup the IP address of the server

ip addr add 192.168.1.1/24 dev eth0
ip link set dev eth0 up
ip route add default via 192.168.1.254

Then we set the root password, and create a user

passwd
useradd itadmin
passwd itadmin

Then you ssh to the CoreOS server.

Then we need to setup the DNS settings

su
cd /etc
rm resolv.conf
vim resolv.conf

Type these into resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

We now need to setup the cloud-config-yaml file

cd /home/core/
vim cloud-config.yaml

Change the settings below so it fit you

#cloud-config
hostname: CoreOS_Name01
users:
- name: "YOURUSERNAME"
groups:
- "sudo"
- "docker"
ssh_authorized_keys:
- ssh-rsa YORESSSH-RSAKEY [email protected]
coreos:
units:
- name: static.network
content: |
[Match]
Name=eth0
[Network]
Address=192.168.1.1/24
Gateway=192.168.1.254
DNS=8.8.8.8
DNS=8.8.4.4

Then we just need to installed the CoreOS

coreos-install -d /dev/sda -C stable -c cloud-config.yaml
shutdown -h now

Remember after you have installed CoreOS, the username and password, and aslo the root password, will be lost.
You need to set this up in the Cloud-config file, if you for some reason will like static password after.

Unmount the CDROM from the server
Start the server again

Usefull things, about CoreOS, after you have installed it

cloud-config is located in /var/lib/coreos-install/user_data

if you need Boot Core os, with autologin. (If you for some reason can’t access the server though network).
Reboot the server, and press “e” in grup (Bootmenu) to edit the first boot option.
At the end of the line that begins with “linux$” add ” coreos.autologin=tty1″ (no quotes).
Press CTRL-X or F10 to boot. You will be logged in as “core” when the system boots.
And use sudo to become root

Move vSwitch vlans information from old host to a new one

To use this examples, there requirements are: VMware PowerCLI and a VMWare vCenter.

This example will copy all vlan’s (Virtualportgroup) from one host to another.
It will take all vlan’s from vSwitch0 on the old host, and copy it to the new host on vSwitch1.

connect-viserver
$oldhost = get-vmhost -name OldServerIP
$newhost = get-vmhost -name NewServerIP
 
$oldhost | get-virtualswitch -name vSwitch0 | get-virtualportgroup | foreach { $newportgroup = $newhost | get-virtualswitch -name vSwitch1 | new-virtualportgroup -name $_.Name -VLanID $_.VLanID }

 

Tomcat Web Server SSL Certificate Installation

How to generate a CSR in Tomcat with Keytool

Create a New Keystore

You will need to create a new Keystore, this is done by this command:

keytool -genkey -alias domainname.prefix -keyalg RSA -keysize 2048 -keystore /path/domainname.prefix.jks

When the commands ask for the firstname and lastname, please type domainname.prefix instead of you name, else the certificate will issues to you name, instead of the domain name.

Generate a CSR from Your New Keystore

  1. Next, you need to generate a CSR file, this is done by this command
    keytool -certreq -alias domainname.prefix -file certreq.cer -keystore /path/domainname.prefix.jks
  2. Type the keystore password that you chose earlier and hit Enter.
  3. Please upload the certreq.cer, to you standard certificate supplier.

Installing the SSL Certificates to the Keystore

  1. You will then get a certificate, save it as signcert.cer
  2. Download aswell the correct intermediate certificate, aswell as the correct root certificate.
  3. Import them with this command:
    keytool -import -trustcacerts -alias root -file root.cer -keystore /path/domainname.prefix.jks
    
    keytool -import -trustcacerts -alias intermediate -file intermediate.cer -keystore /path/domainname.prefix.jks
  1. Import the signed certificate
    keytool -import -trustcacerts -alias domainanme.prefix -file signcert.cer -keystore /path/domainname.prefix.jks

Configuring your SSL Connector

Before Tomcat can accept secure connections, you need to configure an SSL Connector.

  1. In a text editor, open the Tomcat server.xml file.
    The server.xml file is usually located in the conf folder of your Tomcat’s home directory.
  1. Locate the connector that you want to use the new keystore to secure.
    Usually, a connector with port 443 or 8443 is used, as shown in step 4.
  1. If necessary, uncomment the connector.
    To uncomment a connector, remove the comment tags (<!– and –>).
  1. Specify the correct keystore filename and password in your connector configuration.

When you are done, your connector should look something like this:

<Connector port="443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" SSLEnabled="true"clientAuth="false" sslProtocol="TLS" keyAlias="server" keystoreFile="/path/domainname.prefix.jks " keystorePass="your_keystore_password" />

Note: If you are using a version of Tomcat prior to Tomcat 7, you need to change “keystorePass” to “keypass”.

  1. Save your changes to the server.xml file.
  2. Restart Tomcat.

 

Useful commands for Dell servers M1000E CMC

Here are some commands that may come in handy for Dell systems.  

Diagnostic log-gathering commands for an M1000e enclosure

  • racadm dumplogs – Hidden command. Useful but VERY verbose logs
  • racadm racdump – Less verbose than dumplogs
  • racadm getsel – Grab the SEL (System Event Log) from the chassis
  • racadm getraclog – Similar to getting syslog output
  • racadm clrsel / clrraclog –  Clear SEL or raclog. They do fill up

To capture the output of these commands, do something like:

ssh mym1000ehostname dumplogs > /tmp/thelogfile

Current M1000e status

  • racadm getmodinfo – Health, presence, service tags of chassis, blades, switches, etc.
  • racadm getmacaddress – Grab MAC addresses for every ethernet interface on the blades and chassis
  • racadm getsensorinfo – Fan speeds, chassis ambient temperature, power supply status
  • racadm getpbinfo / getpminfo – Power status
  • racadm getversion – Get blade iDRAC versions and blade types
  • racadm getversion -c – Get blade CPLD versions
  • racadm getversion -b – Get blade BIOS versions

(Just type “?” for more information and look at the get commands.  These are the ones I use frequently or ones that are very useful yet may not be well-known)

Powerful M1000e commands

  • racadm racreset -m server-12 – Reset the iDRAC on blade 12 from the CMC (safe for the OS).  If the iDRAC is still alive, it can also be done with ipmitool -H remote-idrac.example.com -I lan mc reset cold
  • racadm serveraction -m server-3 powerdown – Hard power off server 3
  • racadm ? serveraction – Get list of other actions to control power to blades
  • racadm serveraction -m server-4 -f reseat – Virtual reseat a blade. Not safe to do with the OS up since it’s the same as suddenly pulling the power plug.  This fixes many problems.
  • racadm serveraction -a powerup – Power up all blades. (Power up is staggered by the CMC)
  • racadm racreset – Reboot the CMC. Safe operation for the blades. Wear ear plugs.
  • racadm chassisaction -m switch-2 reset –  reset switch 2 from the CMC command line.

Change BIOS settings on Dell servers
The Dell Deployment Toolkit can do all sorts of fun things.  The syscfg command queries and changes BIOS settings such as C-states, C1E, turbo mode, virtualization, hyperthreading/SMT, power loss/recovery boot action, boot order, USB port accessibility, memory node interleaving, and much more.

For desktops and laptops, try Dell’s Client Configuration Toolkit (CCTK) which works in Windows and Linux.

There is an unfortunate bug in Dell’s software depending on how you install it.  For us, running dsetchanges /etc/omreg.cfg to something that then breaks syscfg.  Keep a backup copy and change it back after running dset.  I’m sure we can change the installation paths to make it work… Maybe one of these days.

A few examples (changes usually require a reboot):

  • racadm syscfg -h – List all the options for syscfg
  • racadm syscfg -h –somecommandname – Description of a command
  • racadm syscfg –cstates=enable – Enable C-states
  • racadm syscfg –virtualization – Query current virtualization setting
  • racadm syscfg –bootseq=usbfloppy.slot.1,usbcdrom.slot.1,nic.emb.1,hdd.emb.0 – Change bootorder

 

Source: http://tech.ryancox.net/2010/12/useful-commands-for-dell-servers.html

Enterprise Root CA can’t issue more than 2-year certificate

If you want to issue a certificate with 20 years expiration, run this commands:

certutil -setreg ca\ValidityPeriodUnits 20

certutil -setreg ca\ValidityPeriod "Years"

net stop certsvc

net start certsvc

 

To issues a certificate with a template, run this command

certreq -submit -attrib "CertificateTemplate:CertificateTemplateName" CSRfile.csr

 

 

Found OEM product information

If you need to found OEM product information in Windows, you can run this powershell command.

Such as serial number / product type / product type or Vendor.

gwmi win32_ComputerSystem | select OEMStringArray
wmic csproduct list /format:list
Get-WmiObject Win32_BIOS | Select-Object SerialNumber

 

List all enabled user in Active Directory

How to list all enabled user in active directory:

Get-ADUser -filter {Enabled -eq $True} -Properties "DisplayName","emailaddress" | select name,emailaddress

How to list all enabled user in active directory, for a given OU:

Get-ADUser -SearchBase "OU=Accounts,OU=RootOU,DC=ChildDomain,DC=RootDomain,DC=com" -filter {Enabled -eq $True} -Properties "DisplayName","emailaddress","title" | select name,emailaddress

 

MSTSC – File not found

Today I have this problem that I could connect from a machine, running windows 7.
The error I got was:
The system cannot find the file specified.
C:\Windows\system32\<LANG_NAME>\mstsc.exe.MUI

I then search for mstsc.exe, and right click on it, and choice properties, and choice tab Details, look for language. In my example, my computer was a Danish computer, but MSTSC, was in English.
Look also for the version, if it 6.2 it is a 8.0 version, and if it 6.3 it’s a 8.1 version.
Then download the English version of mstsc (in the right version) on yours computer:
version 8: https://support.microsoft.com/en-us/kb/2592687
version 8.1: https://support.microsoft.com/en-us/kb/2923545 
And install it.