Select only 25 Active Emails as CSV

Uncategorized No Comments

$mail = @(); $teachers = Get-ADUser -filter { mail -like "*@localdomain.com" } -Properties mail | ? { $_.Enabled -eq $True } | select mail | select -First 25 | % { $mail += $_.mail }; $mail -join "," | clip
$mail = @(); $teachers = Get-ADUser -filter { mail -like "*@localdomain.com" } -Properties mail | ? { $_.Enabled -eq $True } | select mail | select -First 25 -Skip 25 | % { $mail += $_.mail }; $mail -join "," | clip
etc.

Powershell Detection Method Uninstaller

Uncategorized No Comments

There is no detection method logic to check that a file doesn’t exist for a required Application.

You have two options to accomplish this:
1. You run a script that creates a file after the uninstall if complete. Then use the file as a detection method.
2. Run a Powershell script that checks that the file is missing and return $true.

Option #2:
sccm-programs

sccm-detection-method


if (-Not (Test-Path "c:\Program Files (x86)\Program\Program.exe") -and -Not (Test-Path "c:\Program Files\Program\Program.exe")) { $true }

Replace fake checkboxes with Content Control Checkboxes in Word

Uncategorized No Comments

Sub ReplaceWithCheckBoxes()
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = ChrW(61551)
        .Replacement.Text = ChrW(9744)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    Do While Selection.Find.Execute
    Selection.Range.ContentControls.Add (wdContentControlCheckBox)
    Loop
    End With
End Sub

Most Recently Edited File

Uncategorized No Comments

Making note of this because I use it so often.  It is an easy way to find where configuration files are after making a change in a GUI.

Lists the last 10 recently edited files:


find . -type f -printf '%T@ %p\n' | sort -n | tail -10

Samba shares with PowerBroker Identity Services

Uncategorized Comments Off on Samba shares with PowerBroker Identity Services

Install PowerBroker Identity Services from their website. I personally only install the the pbis-open.deb and pbis-open_upgrade.deb.

Prerequisites:


sudo apt-get install samba samba-common

You are going to get an error about PAM conflicts with likewise. Just ignore and go on.


sudo /opt/pbis/bin/domainjoin-cli join domain.fqdn username
sudo /opt/pbis/bin/config AssumeDefaultDomain 1
sudo /opt/pbis/bin/config UserDomainPrefix DOMAIN
sudo /opt/pbis/bin/config RequireMembershipOf DOMAIN\\group1 DOMAIN\\group2
sudo /opt/pbis/bin/config LoginShellTemplate /bin/bash
sudo /opt/pbis/bin/samba-interop-install --install
sudo nano /etc/samba/smb.conf

[global]
        security = ADS
        workgroup = DOMAIN
        realm = DOMAIN.FQDN
        machine password timeout = 0
        log file = /var/log/samba/log.%m
#       log level = 2
        Kerberos method = dedicated keytab
        dedicated keytab file = /etc/krb5.keytab

[share]
        writeable = yes
        create mode = 777
        path = /share
        directory mode = 777
        valid users = @DOMAIN\groupname

sudo service smbd restart

Should work!

Find and Sort Files by Recent Modified Date

Uncategorized No Comments

find . -printf "%T@ %Tc %p\n" | sort -n

Gimp 2.8 in Ubuntu 12.04

Uncategorized No Comments

I’m a big fan of the newest feature in GIMP called Single Window Mode. You have to add this PPA to get Gimp 2.8 in Ubuntu 12.04.


sudo su
add-apt-repository ppa:otto-kesselgulasch/gimp -y && apt-get update && apt-get install gimp -y

Open GIMP, click on Windows and click on Single Window Mode.

Yay!

Clone Linux Hard Drive

Uncategorized No Comments

So the other day I wanted to swap out the hard drives in my laptop. I had a sata hard drive that had slightly better performance and I wanted to trade to use the slower hard drive in another project. I figured it would be an easy fix since I pretty much have a good understanding of Linux now. However, I was wrong. My first attempt was booting a live cd, using gparted to create my partitions, then using rsync to clone the hard drive. I attempted 3 times and each time it rebooted I got an error about X being in safemode. All my files were there, I had fixed the boot sector but it still failed. I ended up using DD to copy the partitions and fschk to fix the filesystem size on the new partition. I’ll have to wait until my next need to try out these commands but I wanted to document them.

From a live CD and after clicking on each partition in nautilus to mount them: (found these switches online, untested)


rsync -aAXv /media/BLKIDOFOLDHDD /media/BLKIDOFNEWHDD

To reinstall grub:


install-grub --boot-directory /media/BLKIDOFNEWHDD /dev/sdx

You need to update the /etc/fstab on your new hard drive. You will need to know the BLKID of your newly created partitions. At the command prompt you need to run:


blkid
sudo gedit /media/BLKIDOFNEWHDD/etc/fstab

That should be it. The new hard drive should boot. If nothing else at least some of my commands are documented here for myself and I can test out that rsync command later.

Ubuntu Desktop

Uncategorized No Comments

This is basically for my own documentation as there are hundreds of howto’s already for Ubuntu.

I always do a basic install. After that I start customizing… installing many of my basic programs.

I always run this immediately after install… Update & Reboot.


sudo su
apt-get update && apt-get dist-upgrade -y && apt-get install ubuntu-restricted-extras -y && init 6

Install VLC Media Player and LIBDVD


sudo apt-get install vlc -y
sudo /usr/share/doc/libdvdread4/install-css.sh

I like to make sure my LibreOffice is totally up to date…


sudo su
apt-add-repository ppa:libreoffice/ppa -y && apt-get update && apt-get dist-upgrade -y

Installing Google Chrome and Dropbox are high priorities.
https://www.google.com/intl/en/chrome/browser/index.html#eula
https://www.dropbox.com/install?os=lnx

Also, if I want Conky…


sudo apt-get install conky -y
cd ~/Downloads && wget http://db.tt/sQdJaud6 -O conky.tar.gz && tar -C ~/ -zxvf conky.tar.gz

You’ll then need to add ~/.conky-start to the startup.

I’m a fan of dark wallpapers…
3minimalista

Virus Cleanup

Uncategorized No Comments

Ran into a virus that changed all the windows attributes on all the files/folders at the root of a network share. Every file and folder had the Read Only, System, and Hidden attribute set.

I tried using “attrib -r -h -s /s /d” but for some reason it didn’t change the SYSTEM on the folders.

Final fix was:


for /f "tokens=*" %i in ('dir /b /a:d') do attrib -r -h -s "%i"

Hope this helps someone else.

« Previous Entries