Posts
Git Command Ref
rebase $branchname to the master branch interactively (-i) to allow edits
git rebase master -i $branchname
smbclient
The following command enabled me to send a file from a linux host to a Windows SMB share
Transmission NordVPN Service
The following is a script I wrote to update the transmission-daemon ipv4 bind address with whatever is assigned to my devices tun0 interface.
Ansible Notes
Vim indentation config
RHEL Useful Commands
The following are some basic command references
Vi reminders
Cursor movement
iDrac 6, Linux, Firefox & Natively Unsupported Virtual Console
So after a couple of hours toying and reading online (links to other pages which aided me in this assessment at the end of this post) I’d like to record the specific binaries and config changes I needed to make to access an elderly iDrac6 Virtual Console session from Firefox.
My environment:
Client:
Fedora 32
Firefox 80Dell Perc RAID CLI
The following are a few commands using the Dell perccli64 tool which can be downloaded from Dell (https://www.dell.com/support/home/en-uk/drivers/driversdetails?driverId=F48C2)
OSSEC Rule Examples
Direct copy from the blog https://akmalhisyam.my/blog/ossec-creating-custom-rules for my reference – thanks Akmal!
Linux firewall-cmd
A few useful firewall-cmd syntax examples:
RHEL Subscription Manager Useful Commands
The following was copied from <https://access.redhat.com/discussions/3312101?tour=8> and provides a method of cleaning all subscription manager configuration and re-subscribing – you’ll need an active account with Red Hat to complete this though they do offer free developer accounts (use your account name and not your email address as the username!)
verifying RPM files
The following command will report back the signing key and other useful details for an rpm package:
Linux Ubuntu Kernel Management
To revert to the latest recommended kernel:
PowerShell get-help update-help
Troubleshooting update-help in Powershell can be simplified using the -Force and -Ea 0 commands to continue past errors along with the to “-Ev what” to record the errors in a verbose manner to the $what variable.
Powershell : Move Enabled Computers to Holding OU
Introduction
Powershell : Module – Emailer
Introduction
PowerShell : DHCP Log Backup Script
Introduction
PowerShell : Delete Files Based on Path, Type & Age
Introduction
PowerShell : Compress Folder (IN PROGRESS)
Introduction
Powershell : Add $COMPUTERS to $GROUP
Introduction
Batch : Service Status & Recovery
<pre class="wp-block-code">``` @echo off REM Change the "servicename" value to match your desired service below REM Change the "logfilename" value to your own logfile REM change the %processLinked% value to the process name associated with the target service set servicename="explorerService" set processLinked="explorer.exe" set logfilename="C:\Logs\thisscript.log" rem get the date and time For /f "tokens=1-3 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%b-%%a) For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b) rem execute the "sc query <service>" command and loop through the output for /F "tokens=3 delims=: " %%i in ('sc query "%servicename%" ^| findstr " STATE"') do ( rem log the datetime and service state to the logfile echo %mydate%_%mytime% >> %logfilename% echo "%servicename% Service's current state is: %%i" >> %logfilename% rem restart the service after killing off the associate %processLinked% echo "%servicename% Service is forcibly restarting..." >> %logfilename% taskkill /IM %processLinked% /F >> %logfilename% net start %servicename% >> %logfilename% )
```
VSS Admin Writers & Services
Powershell DHCP Commands
Get-DhcpServerv4Reservation
SCCM Site Console (Admin UI) Failure
Following a number of interferences with our beloved SCCM Primary Site it was in a broken state.
The “\Program Files\Microsoft Configuration Manager\AdminConsole\AdminUILog\SmsAdminUI.log” reported:
“Error Code:
ProviderLoadFailure
\r\nSystem.Management.ManagementException\r\nProvider load failure \r\n at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryResultsObject.<GetEnumerator>d__74.MoveNext()\r\nManagementException details:
instance of __ExtendedStatus
{
Operation = “ExecQuery”;
ParameterInfo = “SELECT * FROM SMS_Site WHERE SiteCode = ‘XXX’”;
ProviderName = “WinMgmt”;
};
”Windows Domain Trust Relationship Failed
<pre class="wp-block-code">``` $creds = get-credential Test-ComputerSecureChannel -Repair -credential $creds
```
Powershell Domain Controller Assessment
To get a list of the FSMO Role holders for a Single Domain.
Linux du folder sizes
List all folders in the /path/to/parent directory along with their size in (h)uman readable (m)egabytes
Powershell : Domain Binding & Description
To bind a machine to the domain, rename it and put it in the desired OU:
Windows Server eventlog ID 5152 Filtering Platform Packet Drop
After some online searching around EVENT ID 5152 which had started littering my DC’s eventlogs following some additional audit enabling I discovered how to silence these logs from the SECURITY eventlog, leaving them in place for the FIREWALL log instead:
Plex Media Server Ubuntu Sources
Thanks to https://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-install-plex-media-server-on-ubuntu-18-04-ubuntu-16-04-linux-mint-19.html
IPv4 Subnet Calculating
Calculating the Netmask Length (also called a prefix):
Powershell : Useful Commands
Get members of a group:
Powershell : Find users based on specific property and location
``
Remote Desktop CredSSP Failure
Temporary reprieve for affected clients:
PowerShell : Editing File Properties
Whilst writing a script which included a recycler section to ensure files older than 14 days were removed from a directory I needed a way to test the code. I then came across the set-itemproperty cmdlet which was just what I needed.
SCCM DP Package Transfer Errors
The Problem
Windows Commands : Safeboot
Safe Mode:
Powershell Get-ADComputer
The following Powershell commmand uses the Get-ADComputer cmdlet to query AD and return a CSV with the headers “OU”,”Name” & “OperatingSystem”.
It was designed to return this information to marry up with GPO controlled policies against the OUs so I could plan servicing schedules.Cancelling a Scheduled chkdsk (Check Disk)
- Boot from the Windows 10 DVD / install media
- [SHIFT]+[F10] to reveal a command prompt
- REGEDT32 to open registry editor
- Highlight HKLM > File > Load Hive
- Navigate to the local system disk :\Windows\System32\config and open [SYSTEM]
- Navigate to HKEY_LOCAL_MACHINE\<LOADED HIVE NAME>\CurrentControlSet\Control\Session Manager\ and edit the BootExecute MULTI-SZ value to read only: autocheck autochk *
- Reboot
- tadaa!
WIndows Command For-loop
for /f "delims=*" %f in ('dir "C:\folder\of\files\*.efs" /b') DO C:\folder\of\executable\program.exe -f "C:%~pf%f"
Powershell Query – get-ADObject filter for Bitlocker
The following command returns all objects in the specified OU (replace XXX with your own values) which have Bitlocker recovery information and what the recovery key is.
VMWare Workstation 14 Ubuntu
I recently encountered a minor issue attempting to create additional VMs in VMWare Workstation 14 on Ubuntu. The error I received suggested there wasn’t enough memory free to power on an additional VM but the host has 32GB of RAM and I’d allocated 20GB across all VMs.
eSXi update storage drivers
1. Power down all running VMs on host (or migrate to another eSXi host if using vCenter)
Powershell : Query for user’s last logon date
I needed to work out some AD accounts’ last logon dates to make a further assessment, in powershell I found this was fairly simple:
Ubuntu, Kernel 4.14+, VMWare Workstation 14
I was unable to compile the ubuntu kernel patches for VMWare Workstation 14.0 for a couple of reasons on Ubuntu 16.04 with an updated kernel v4.14:
Ubuntu, LVM, Partitions
Ubuntu disk partition extension under LVM:
Ubuntu
Issuing “apt-get update” or “apt-get upgrade” commands resulted in the following error:
Active Directory Powershell Last Login Date
``
Ubuntu & Virtualbox
Ubuntu 16.04 (kernel 4.14), Virtualbox
Microsoft Office 2016 Licensed via KMS but with Activation Splash Screen on launch
Resolved by following https://support.office.com/en-us/article/Office-repeatedly-prompts-you-to-activate-on-a-new-PC-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1
Plotting Multiple Postcodes on Google Maps
Description of the task
Powershell : Query Computer for Installed Software
Onwards with the powershell quest, this code queries the remote computer named “PC1” for installed software and writes the results to a local file “C:\PC1_InstalledPrograms.csv”. The ouput is filtered for the “Displayname”,”Publisher”,”Version” and sorted by DisplayName.
Windows 7 Boot Sector Repair
The Scenario
Intel Network ProSet Fails to Uninstall
I recently struggled to upgrade my Intel(R) Network Connections driver installation from v22.4.10 (unsupported in Windows 10 1703) due to a corrupted uninstaller.
Subinacl.exe Microsoft Service Permissions
A nice little tool to manage service permissions on Windows name subinacl is available at https://www.microsoft.com/en-gb/download/details.aspx?id=23510
799 2
``` xcopy /C/H/R/S/Y c:\ d:\
Tracerplus : Change Connect Project via Text
Tracerplus Connect software makes a hardcoded reference to the linked Tracerplus Desktop project. However if you need to relocate the directory of the Desktop project that will break the Connect references to the fields and cause the synchronization to fail.
Certbot and letsEncrypt free SSL renewal Ubuntu
- Enable TCP:443 access to the server from the internet
- Check local IPTABLES fw access for public TCP:443 access too
- SSH into the server and run the following command:
sudo certbot — –force-renewal -d <certname here>
Windows Server 2012 .NET
Dism /online /enable-feature /featurename:NetFX3 /featurename:NetFx3ServerFeatures /Source:X:\sources\sxs
Note: X: is the drive letter of DVD drive on the computer, adjust it accordingly.Microsoft WSUS Rebuild
To re-install WSUS with a clean database i.e. no previous configuration:
Open Sense (PFSense Fork) Notes
NAT Configuration on OpenSense
Adobe Photoshop CS3 Crashing When Exiting
It’s very old now but still in use somewhere … Running on Windows Ent x64 and crashing when exiting.
Intel USB 3.0 eXtensible Controller for Intel® 7 Series/C216 Chipset Family Windows 7 x64 BSOD
We have a number of Dell Optiplex 9010’s in use running Windows 7 Enterprise x64 which have Intel’s USB 3 chipset C216. However, the Dell cab file of drivers did not appear to contain a suitable driver for the systems via our deployment mechanism.
VMWare ESXi
Troubleshooting from SSH should begin with /var/log/vmkernel.log
Sophos Cloud / Enterprise Client Forcible Removal
https://community.sophos.com/products/sophos-cloud/f/sophos-central/75044/re-register-computer-issue—no-tamper-protection-password
Windows 10 Disable Cortana
Either through GPO :
Windows Software Won’t Uninstall – Reboot Required Despite Rebooting
If this problem happens then it may be a result of failing pending changes to the Windows OS. These file changes are listed in a registry key:
Export Windows Registry
To complete a full registry backup of Windows:
Group Policy Management – Outlook 2016 Policy GUI Bug
After a little puzzling with MS Outlook 2016 Synchronization settings GPO I thought I’d share this small bug in the GUI (at least for our environment 2k8r2 ADs):
Plone User Management URL
http://{website-address-here}/plone_control_panel
Deploying iTunes to Windows with Parental Controls
The Scene
Windows 10 Reboot Loop : Startup Repair
I came across an HP unibody laptop which was caught in a Windows 10 reboot recovery startup loop. Unable to complete an SFC scan I discovered a DISM command which will trash any pending disk actions and in this case allowed the system to boot to the login prompt (after throwing away a number of Windows updates).
Website Plone
service status plone status/restart (takes a couple of mins)
MAC OSX Create Bootable USB Installation Media
Here is the command to create a bootable installation USB for the latest OSX 10.12 Sierra, it’s the same as previous releases, at least as far back as Mavericks 10.9 with the only change being the name of the installation.app (“Install macOS Sierra.app” in this case) and the name of the USB volume I’m writing to (“SierraInstaller” in this case).
Windows Printer Communication / Printing Issues
This post is intended to cover a number of printing issues in Windows, I’ll add cases and solutions over time.
Pending File Rename Preventing Install
I had to install some Dell software but kept receiving the message “Unable to complete the installation due to pending file rename operation” on Windows 10 Enterprise.
Renaming the registry key HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations to HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperationsOLD allowed me to complete the installation.Mac OSX Yosemite & iCloud Failures
The Analysis
Microsoft .Net Framework Updates
Great article on command line switches for .Net Framework installation releases:
Linx Tablet Windows 8.1 to Windows 10 Upgrade
Backup Process, pre-upgrade
Windows 10 WAIK Image (.wim) Preparation
Aim of this guide
Linux Learnings
dave@mule:~$ arr=($(ipcs -p | awk -F ' *' '$3 ~ /^[0-9]+$/ {print $3}' ))
Silk, iSilk Wonderland
Notes on installing and using Silk network monitoring on a pre-configured log server named Wonderland
MySQL Commands Maintenance v2
Create an Archive table for unused assets
Outlook Web Access – Extract Email Headers
To obtain the header information from within Nexus web access (https://owa.nexus.ox.ac.uk):
HP Laserjet 4015 Maintenance
Reset the Maintenance Kit:
Eduroam Profile Rebuild
There is a known issue with certain wireless access points and some clients. The solution is to:
HP Printer Universal Print Driver & Laserjet 4015DN
Wouldn’t print menu card size for Development without constant OK button presses.
University Mailing Workaround for An Alias to Email more than 1 person
A solution from a friend at St. John’s College:
HP Printer Not Printing MS Office or Text Documents
The Issue:
WSUS Installation
Attempting to install WSUS on server 2012 and then reinstall it.
607 2
https://technet.microsoft.com/en-us/magazine/hh825626.aspx
Brother DCP7055 New Toner not recorgnised
A Brother DCP-7055 had a new toner installed which is failed to recognise.
courses:edx.org
Handy Bash Shortcuts
Mac OSX Hard Disk Recovery
Couldn’t mount a disk image taken from a failing HDD.
Outlook Safe Mode Forced after KB3114409
This update, released 8th December 2015 caused safe mode to be forced for Outlook 2010.
VMWare HP Microserver Gen 8
Had very slow disk performance on a RAID 1 array in ESXi on my new HP Gen 8 microserver and found hardware acceleration was disabled.
GPO : Hide Image Thumbnail on Network Drive
To turn off the thumbnail preview in Windows Explorer on network drives use the GPO:
HP Printer Firmware Update : Windows Print Server
I was needing to update the firmware on an HP P3015 Laserjet printer and the “Firmware Update” utility on the web interface was failing.
Windows 10 Deployment – Wim Creation
I was struggling to start with creating an ‘Unattend.xml’ through the Windows System Image Manager.
Keble : Microsoft Office 2013 MSP’s
MS OFFICE 2013 MSP:
Keble : Microsoft Office 2010 MSP’s
MS OFFICE 2010 MSP:
Create El Capitan 10.11 USB Installer Disk
- Download the installer from the App Store but do not install it, close the installer when it launches
- Format an 8GB+ USB Drive in the GUID type and Journaled (not case sensitive) partition
- run the command (where Untitled is the name of the partition you created in step 1):
sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app --nointeraction
- Sit back and relax, smoke a pipe while you wait maybe
Windows 10 : Control Panel : Personalization : Wallpaper
To apply photos recursively from a folder as desktop background in Windows 10 access the old control panel item via the run command:
Google Sheets Image into Cell image(url)
Full credit to Eric Mercer via http://googlesheetshelp.blogspot.fr/2014/11/method-for-displaying-images-stored-on.html
ubuntu keyboard layout uk
setxkbmap -layout gb
Django Workflow
administration:
Initial Django Setup for itstock project
The following steps assume you’ve completed part 1 :http://www.davegernon.co.uk/techblog/django-setup-with-virtualenv-pycharm/
django setup with virtualenv & PyCharm
Setting up my django development (basic).
Setup SSH access on bitbucket for a machine
https://confluence.atlassian.com/bitbucket/set-up-git-and-mercurial-ubuntu-linux-269982882.html
tcpdump Mac OSX Wireless Monitoring Mode
The preamble
Mac OSX dd Disk Read / Write
dd bs=512 if=/dev/rXX# of=/some_dir/foo.dmg conv=noerror,sync
monitor for dhcp offers on network
sudo ifconfig ethX promisc tshark -i ethX -n port 68 -R 'bootp.type == 2'
Corrupted Hard Disk Recovery
Using “dd” inside of OSX I was able to copy the affected disk bit by bit to an image file and then convert that file to a readable format for OSX to mount:
Mac OSX “Bubble” Malware Browser Infection
Had a curious case of a Macbook Pro which had a browser hijack from what appeared to be some nasty Malware.
Oracle Virtual Box Mac OSX Physical Disk Attachment
1. Get the identity of the physical disk using
“diskutil list”
from the command line. Usually it’s named “System” if booting from an OSX Live USB drivetcpdump notes
sudo tcpdump -i eth0 port 67 or port 68 -nev and “ether host <<MAC ADDRESS>>”
Windows 7 SSD Tuning
Source: http://www.computing.net/howtos/show/solid-state-drive-ssd-tweaks-for-windows-7/552.html
HOW TO ADD ADDITIONAL IP TO A NETWORK INTERFACE ON MAC OS X
Source: https://gerrydevstory.com/2012/08/20/how-to-create-virtual-network-interface-on-mac-os-x/
Water Monitoring
http://www.recordsforbuildings.com/
Technicolor TG582n Configuration
dhcp server lease list (lists the current DHCP clients)
dhcp server lease delete clientid=xx:xx:xx:xx:xx:xx ( xx etc. is the MAC address of appropriate client from above list – deletes the current lease)
dhcp server lease add clientid=xx:xx:xx:xx:xx:xx pool=LAN_private addr=192.168.1.x leasetime=0 (adds required IP for appropriate client with infinite lease time)
saveallWindows: Remote Desktop Rescue
%systemroot%system32mstsc.exe /admin
Windows: WLAN WPA Deployment
to deploy a wlan profile along with WPA2 key (in plain text so be warned!):
Outlook : Recreate autocomplete stream data
- Import the FirstName, LastName and EmailAddress from all sent emails into individual contacts in the” Suggested Contacts” folder inside of the systems default Outlook profile via:
Outlook : Powershell : Import contacts from sent items
`$outlook` `= ``new-object` `-com` `outlook.application``$olFolders` `= ``"Microsoft.Office.Interop.Outlook.OlDefaultFolders"` `-as` `[type]``$namespace` `= ``$outlook``.GetNameSpace(``"MAPI"``)``$sentItems` `= ``$namespace``.getDefaultFolder(``$olFolders``::olFolderSentMail)``$alreadyAddedEmails` `= @() ``#Empty Array``$counter` `= 0;``$totalItems` `= ``$sentItems``.items.count;``Write-Host` `"Scanning through"` `$totalItems` `"emails in SentItems"``$contacts` `= ``$outlook``.Session.GetDefaultFolder(``$olFolders``::olFolderSuggestedContacts)``##############################################################################################################``# FUNCTION - Adds Name/Email to SuggestedContacts - Unless it has already been added before (by this script).``##############################################################################################################``Function` `AddToSuggestedContactsIfNotAlreadyAdded (``$name``, ``$email``)``{ `` ``if``((``$name` `-eq` `"``") -or ($email -eq "") -or ($name -eq $null) -or ($email -eq $null)){`` ``return;`` ``} `` ``if ($name -like '*@*') {`` ``$name = $null`` ``}`` ``else {`` ``$name = $name.Replace("``'``", "").Replace("""", "")`` ``}`` ``$contactAlreadyAdded = $false`` ``foreach ($elem in $global:alreadyAddedEmails) {`` ``if(($elem.ToLower() -eq $email.ToLower())){`` ``$contactAlreadyAdded = $true`` ``if ($name -eq $null) { $name = "``** No Display Name **``" }`` ``Write-Host ($global:counter)"``/``"($totalItems) "``SKIPPED ``" $name.PadRight(25,"` `") "``-``" $email`` ``return;`` ``}`` ``}`` ``if(!$contactAlreadyAdded ) {`` ``$newcontact = $contacts.Items.Add()`` ``$newcontact.FullName = $name`` ``$newcontact.Email1Address = $email`` ``$newcontact.Save()`` ``$global:alreadyAddedEmails += $email`` ``if ($name -eq $null) { $name = "``** No Display Name **``" }`` ``Write-Host ($global:counter)"``/``"($totalItems) "``ADDED ``" $name.PadRight(25,"` `") "``-" ``$email`` ``}``}``# Loop through all emails in SentItems``$sentItems``.Items | % { `` ``#Loop through each recipient`` ``$_``.Recipients | %{`` ``AddToSuggestedContactsIfNotAlreadyAdded ``$_``.Name ``$_``.Address`` ``}`` ``$global:counter` `= ``$global:counter` `+ 1``}`Outlook : Powershell : Clear Duplicate Contacts
#########################################################
# #
# Remove Duplicate Outlook Contacts by Jean Louw #
# Blog http://powershellneedfulthings.blogspot.com/ #
# #
#########################################################Outlook Command Line Switches
# Direct copy from http://www.outlook-tips.net/how-to/using-outlook-command-lines/ mac office auto recover
/Users/<USERNAME>/Library/Application Support/Microsoft/Office/Office 2011 AutoRecovery
Mac DNS Reset
Yosemite:
/System/Library/LaunchDaemons/com.apple.discoveryd.plistOutlook: Export all mail into Explorer
This guide uses a VB script copied from https://techniclee.wordpress.com/2013/05/09/export-outlook-folders-to-the-file-system/ as it’s basis.
courses.edx.org : bash and scripting linux
Character Description # Used to add a comment, except when used as #, or as #!when starting a script \ Used at the end of a line to indicate continuation on to the next line ; Used to interpret what follows as a new command $ Indicates what follows is a variable Mac OS X : Adobe Plugin Fails to Open PDF’s in Safari
> 1. Open a Finder window then from the menu bar click Go > Go to Folder
>
> 2. Type or copy paste the following: /Library/Internet Plug-Ins
>
> 3. Click Go.
>
> 4. If you see the: [AdobePDFViewer] plugin in the Internet Plug-Ins folder, move it to the trash.
>
> 5. Quit and relaunch SafariMac OS X 10.10 Yosemite Installer USB
1. GUID Partition USB Disk
Macbook / pro /air: Disable / Enable keyboard
<pre class="alt2" dir="ltr">sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/
courses.edx.org: PDF viewing, editing
Modifying PDFs with pdftk
courses.edx.org: Linux Printing with lp
Using lp
courses.edx.org: z Command Family
SSL 3 Vulnerability Poodle : Chrome Fix
Launch Chrome with command line flag:
courses.edx.org : tr, tee, wc, cut
The tr utility is used to translate specified characters into other characters or to delete them. The general syntax is as follows:
courses.edx.org : grep
Command Usage grep [pattern] <filename> Search for a pattern in a file and print all matching lines grep -v [pattern] <filename> Print all lines that do not match the pattern grep [0-9] <filename> Print the lines that contain the numbers 0 through 9 grep -C 3 [pattern] <filename> Print context of lines (specified number of lines above and below the pattern) for matching the pattern. Here the number of lines is specified as 3. courses.edx.org : regex
Metacharacter Description Specifies the next character as either a special character, a literal, a back reference, or an octal escape. ^ Matches the position at the beginning of the input string. $ Matches the position at the end of the input string. * Matches the preceding subexpression zero or more times. + Matches the preceding subexpression one or more times. ? Matches the preceding subexpression zero or one time. {n} Matches exactly n times, where n is a non-negative integer. {n,} Matches at least n times, n is a non-negative integer. {n,m} Matches at least n and at most m times, where m and n are non-negative integers and n <= m. . Matches any single character except “n”. [xyz] A character set. Matches any one of the enclosed characters. x|y Matches either x or y. [^xyz] A negative character set. Matches any character not enclosed. [a-z] A range of characters. Matches any character in the specified range. [^a-z] A negative range characters. Matches any character not in the specified range. b Matches a word boundary, that is, the position between a word and a space. B Matches a nonword boundary. ‘erB’ matches the ‘er’ in “verb” but not the ‘er’ in “never”. d Matches a digit character. D Matches a non-digit character. f Matches a form-feed character. n Matches a newline character. r Matches a carriage return character. s Matches any whitespace character including space, tab, form-feed, etc. S Matches any non-whitespace character. t Matches a tab character. v Matches a vertical tab character. w Matches any word character including underscore. W Matches any non-word character. un Matches n, where n is a Unicode character expressed as four hexadecimal digits. For example, u00A9 matches the copyright symbol courses.edx.org : sort, uniq, paste, join
Syntax Usage sort <filename> Sort the lines in the specified file cat file1 file2 | sort Append the two files, then sort the lines and display the output on the terminal sort -r <filename> Sort the lines in reverse order sed & awk – Linux Tools, courses.edx.org
Command Usage sed s/pattern/replace_string/ file Substitute first string occurrence in a line sed s/pattern/replace_string/g file Substitute all string occurrences in a line sed 1,3s/pattern/replace_string/g file Substitute all string occurrences in a range of lines sed -i s/pattern/replace_string/g file Save changes for string substitution in the same file Networking in Linux
Networking Tools Description ethtool Queries network interfaces and can also set various parameters such as the speed. netstat Displays all active connections and routing tables. Useful for monitoring performance and troubleshooting. nmap Scans open ports on a network. Important for security analysis tcpdump Dumps network traffic for analysis. iptraf Monitors network traffic in text mode. emacs commands
Linux Foundation
Vi Basics
Linux Foundation
Access VBA Loop
Night Porter Email (Pyinstaller, PiP etc)
1. Install Python 2.7
Access VBA > MySQL Update TimeSheetRates
Private Sub UpdateTimeSheetCalculations()
On Error GoTo Err_UpdateTimeSheetCalculations
‘this simple subroutine looks at the MySQL View “time_sheet_calc_dynamic” and copies the calculated values therein to the time_sheet table
‘The “time_sheet_calc_dynamic” does not include records where the “ts_calculation_completed” column is set to 1. The DB Manager can switch this flag
‘on and off via the Time Sheet Management form or when running a report for the timesheet. This means calculations made are “frozen in time”
‘with the rates as they were so subsequent changes to mileage or on-call rates are not re-calculated.Dynamic MySQL View for Calculated fields
the field on it’s own:
SELECT IF(z.ts_mon_journeys * (SELECT tsm_mileage from time_sheet_mileage where tsm_user=’MinHourPerJourney’) > IfNull(z.ts_mon_hours,0), z.ts_mon_journeys * (SELECT tsm_mileage from time_sheet_mileage where tsm_user=’MinHourPerJourney’), z.ts_mon_hours) TotalHoursMaintenance MySQL – JobSheets Android: Jobsheet_History
CREATE VIEW jobsheet_history AS
SELECT x.jr_id, x.jr_jobid, x.jr_userid, x.jr_user_assigned, x.jr_pdaid, x.jr_datedue, x.jr_scandt, x.jr_priloc, x.jr_secloc, x.jr_terloc, x.jr_workrqd, x.jr_workcomp, x.jr_workleft, x.jr_jobcomp, x.jr_timetaken,
x.jr_pu1barcode, p1.il_description pu1desc, x.jr_pu1qty,
x.jr_pu2barcode, p2.il_description pu2desc, x.jr_pu2qty,
x.jr_pu3barcode, p3.il_description pu3desc, x.jr_pu3qty,
x.jr_pu4barcode, p4.il_description pu4desc, x.jr_pu4qty,
x.jr_pu5barcode, p5.il_description pu5desc, x.jr_pu5qty,
x.jr_pu6barcode, p6.il_description pu6desc, x.jr_pu6qty,
x.jr_pu7barcode, p7.il_description pu7desc, x.jr_pu7qty,
x.jr_pu8barcode, p8.il_description pu8desc, x.jr_pu8qty,
x.jr_pu9barcode, p9.il_description pu9desc, x.jr_pu9qty,
x.jr_pu10barcode, p10.il_description pu10desc, x.jr_pu10qty, x.jr_ts
FROM (((((((((jobsheet_report x
LEFT JOIN item_list as p1 on x.jr_pu1barcode=p1.il_barcode)
LEFT JOIN item_list as p2 on x.jr_pu2barcode=p2.il_barcode)
LEFT JOIN item_list as p3 on x.jr_pu3barcode=p3.il_barcode)
LEFT JOIN item_list as p4 on x.jr_pu4barcode=p4.il_barcode)
LEFT JOIN item_list as p5 on x.jr_pu5barcode=p5.il_barcode)
LEFT JOIN item_list as p6 on x.jr_pu6barcode=p6.il_barcode)
LEFT JOIN item_list as p7 on x.jr_pu7barcode=p7.il_barcode)
LEFT JOIN item_list as p8 on x.jr_pu8barcode=p8.il_barcode)
LEFT JOIN item_list as p9 on x.jr_pu9barcode=p9.il_barcode)
LEFT JOIN item_list as p10 on x.jr_pu10barcode=p10.il_barcode;Windows 7 Safe Mode Enable Windows Installer
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSafeBootNetworkMSIServer or HKLMSYSTEMCurrentControlSetControlSafeBootMinimalMSIServer change “Default” reg_sz value to “@Service”
Maintenance MySQL – Timesheets Android: time_sheet_we_next
CREATE VIEW time_sheet_we_next AS
SELECT x.tsw_we from time_sheet_we x
WHERE x.tsw_we >=DATE_SUB(now(), INTERVAL 21 DAY)
AND x.tsw_weMaintenance MySQL – Timesheets Android: time_sheet_last_month
CREATE VIEW time_sheet_last_month AS
SELECT * from time_sheet_last t
WHERE t.ts_WE >= DATE_ADD(LAST_DAY(DATE_SUB(NOW(), INTERVAL 2 MONTH)), INTERVAL 1 DAY);Maintenance MySQL – Timesheets Android: time_sheet_last
1. time_sheet_last_sub
CREATE VIEW time_sheet_last_sub AS
SELECT DISTINCT MAX(ts_id) ts_id, ts_userid, ts_WE, MAX(ts_scandt) ts_last_synch
FROM time_sheet GROUP BY ts_userid, ts_WE;Maintenance MySQL – Job Sheets Android: locations_unique
CREATE VIEW locations_distinctpri AS
SELECT DISTINCT l_priloc from locations;Maintenance MySQL – Job Sheets Android: jobsheet_report_closed
CREATE VIEW jobsheet_report_closed AS
SELECT * FROM jobsheet_report_last_entryMaintenance MySQL – Job Sheets Android: jobsheet_report_open
CREATE VIEW jobsheet_report_open AS
SELECT * FROM jobsheet_report_last_entry
WHERE jr_jobcomp=0
OR jr_jobcomp IS NULL ;Maintenance MySQL – Job Sheets Android: jobsheet_report_last_entry
1. jobsheet_report_last_entry_sub
CREATE VIEW jobsheet_report_last_entry_sub AS
SELECT MAX(jr_id) id, jr_jobid, MAX(jr_scandt) scandt
FROM jobsheet_report
GROUP BY jr_jobid;Maintenance MySQL – Job Sheets Android: jobsheet_report_total
1. jobsheet_report_total_sub
CREATE VIEW jobsheet_report_total_sub(jobid, barcode, qty) AS
(SELECT jr_jobid jobid, jr_pu1barcode Barcode, jr_pu1qty qty FROM jobsheet_report_last_entry WHERE jobsheet_report_last_entry.jr_pu1barcode “”)
union all
(SELECT jr_jobid jobid, jr_pu2barcode Barcode, jr_pu2qty qty FROM jobsheet_report_last_entry WHERE jobsheet_report_last_entry.jr_pu2barcode “”)
union all
(SELECT jr_jobid jobid, jr_pu3barcode Barcode, jr_pu3qty qty FROM jobsheet_report_last_entry WHERE jobsheet_report_last_entry.jr_pu3barcode “”)
union all
(SELECT jr_jobid jobid, jr_pu4barcode Barcode, jr_pu4qty qty FROM jobsheet_report_last_entry WHERE jobsheet_report_last_entry.jr_pu4barcode “”)
union all
(SELECT jr_jobid jobid, jr_pu5barcode Barcode, jr_pu5qty qty FROM jobsheet_report_last_entry WHERE jobsheet_report_last_entry.jr_pu5barcode “”)
union all
(SELECT jr_jobid jobid, jr_pu6barcode Barcode, jr_pu6qty qty FROM jobsheet_report_last_entry WHERE jobsheet_report_last_entry.jr_pu6barcode “”)
union all
(SELECT jr_jobid jobid, jr_pu7barcode Barcode, jr_pu7qty qty FROM jobsheet_report_last_entry WHERE jobsheet_report_last_entry.jr_pu7barcode “”)
union all
(SELECT jr_jobid jobid, jr_pu8barcode Barcode, jr_pu8qty qty FROM jobsheet_report_last_entry WHERE jobsheet_report_last_entry.jr_pu8barcode “”)
union all
(SELECT jr_jobid jobid, jr_pu9barcode Barcode, jr_pu9qty qty FROM jobsheet_report_last_entry WHERE jobsheet_report_last_entry.jr_pu9barcode “”)
union all
(SELECT jr_jobid jobid, jr_pu10barcode Barcode, jr_pu10qty qty FROM jobsheet_report_last_entry WHERE jobsheet_report_last_entry.jr_pu10barcode “”);Maintenance MySQL – Stock Report Android: stock_record_current_day
CREATE VIEW stock_record_current_day AS
SELECT * FROM stock_record
WHERE
stock_record.sr_ts >=DATE_SUB(now(), INTERVAL 1 DAY);Maintenance MySQL – Stock Report Android: congroups
CREATE VIEW congroups AS
SELECT DISTINCT itemgroup
FROM t_conlist;Maintenance MySQL – Stock Report Android: stock_record_change_request
CREATE VIEW stock_record_change_request AS
SELECT
x.sr_id,
x.sr_barcode,
x.sr_changedesc,
x.sr_changegroup,
x.sr_changepri,
x.sr_changesec,
x.sr_changeter,
y.il_description,
y.il_group,
y.il_priloc,
y.il_secloc,
y.il_terloc,
x.sr_checkrqd,
x.sr_userid,
x.sr_ts
FROM stock_record x
LEFT JOIN item_list y ON x.sr_barcode=y.il_barcode
WHERE x.sr_checkrqd=”Yes”
ORDER BY x.sr_barcode;Maintenance MySQL – Stock Report Android: stock_record_alert
CREATE VIEW stock_record_alert AS
SELECT il_barcode, stock_level
FROM stock_record_count
WHERE stock_levelMaintenance MySQL – Stock Report Android: stock_record_count
1. stock_record_count_sublocal
CREATE VIEW stock_record_count_sublocal AS
SELECT sr_barcode barcode, SUM(sr_qty) qtyused
FROM stock_record
GROUP BY barcode;Maintenance MySQL – Stock Report Android: stock_record_history
CREATE VIEW stock_record_history AS
SELECT DISTINCT
y.sr_id,
y.sr_scandt,
y.sr_barcode,
x.il_description,
x.il_priloc,
x.il_secloc,
x.il_terloc,
x.il_group,
y.sr_qty,
y.sr_changedesc,
y.sr_changegroup,
y.sr_changepri,
y.sr_changesec,
y.sr_changeter,
y.sr_userid,
y.sr_deviceid,
y.sr_ts
FROM item_list x, stock_record y
WHERE y.sr_barcode=x.il_barcode;Maintenance MySQL – Asset Report Android: asset_report_damaged
CREATE VIEW asset_report_damaged AS
SELECT
a.ar_id,
a.ar_barcode,
x.al_description,
x.al_asset_group,
x.al_priloc,
x.al_secloc,
x.al_terloc,
a.ar_scandt,
a.ar_itemstatus,
a.ar_actiontaken,
a.ar_actionleft,
a.ar_datedue,
a.ar_userid,
a.ar_ts
FROM asset_report_last a
LEFT JOIN asset_list x
ON a.ar_barcode=x.al_barcode
WHERE a.ar_itemstatus NOT LIKE “%1%”;Maintenance MySQL – Asset Report Android: asset_report_last
1. asset_report_last_sub
CREATE VIEW asset_report_last_sub AS SELECT ar_barcode, MAX(ar_ts) ar_ts FROM asset_report GROUP BY ar_barcode;Maintenance MySQL – Asset Report Android: item_list_groups
CREATE VIEW item_list_groups AS
SELECT DISTINCT il_group
FROM item_list;Maintenance MySQL – Asset Report Android: asset_report_history
CREATE VIEW asset_report_history AS
SELECT DISTINCT y.ar_scandt, y.ar_datedue, y.ar_id, y.ar_barcode, x.al_description, x.al_priloc, x.al_secloc, x.al_terloc, x.al_asset_group, y.ar_itemstatus, y.ar_actiontaken, y.ar_actionleft, y.ar_userid, y.ar_pdaid, y.ar_ts, y.ar_checkrqd, y.ar_changedesc, y.ar_changegroup, y.ar_changepri, y.ar_changesec, y.ar_changeter FROM asset_list x, asset_report y WHERE y.ar_barcode=x.al_barcode;Maintenance MySQL – Asset Report Android: asset_report_change_request
CREATE VIEW asset_report_change_request AS
SELECT x.ar_id, x.ar_barcode, y.il_description, y.il_group, y.il_priloc, y.il_secloc, y.il_terloc, x.ar_userid, x.ar_scandt, y.il_ts, x.ar_ts FROM asset_report x
LEFT JOIN item_list y ON x.ar_barcode=y.il_barcode
WHERE ar_checkrqd=”Yes”;EMIS Install
1. IT logs onto the PC with local admin privileges / runs the following installers with elevated privileges
2. Nurse logs onto https://vpn.oxnet.nhs.uk/ (the Nurse must login to “Oxfordshire-GP”) and downloads the VPN client
3. IT installs the VPN client on the target PC
4. The nurse connects to the VPN using his/her credentials
5. IT connects to ftp://213.146.154.199 (username and password required – available via phone from myself or EMIS support) and downloads “SDS 6 Install.exe”
6. IT installs “SDS 6 Install.exe” obtaining the nurses surgery site ID to complete the installation
7. The nurse logs into EMIS
8. IT completes the auto-updating of the software
9. IT logs off local admin / removes elevated privileges and disconnects EMIS and VPN
10. Nurse runs through the VPN connection and EMIS launch using their own user accountDisable Spell checker
Needed this info to disable spell checker for exam pc’s.
Windows Safe Mode Install Registry Key
Windows Registry Editor Version 5.00
tcpdump2
verbatim from http://www.danielmiessler.com/study/tcpdump/
tcpdump
verbatim from http://www.thegeekstuff.com/2010/08/tcpdump-command-examples/
Crashplan backup server on the pi
Complete credit to http://www.bionoren.com/blog/2013/02/raspberry-pi-crashplan/#comment-97
CMRS / Georgia
CMRS / GEORGIA:
Step 1:
look at importvisiting.pl (-h) on dc1-keble, note data type required (existing .csv’s from previous years visible in dc1-keblescriptscsv) – NOTE NO SPACE BETWEEN “,” and [FirstName]!!
match provided data to this format, generating OWL credentials to finalise (use txt file for OWL generation including one name per line (surname,firstname middle(s))Outlook 2007 to 2010 and NK2
With Outlook 2010+ on Exchange 2010+ NK2 files are deprecated and replaced with server side(ish) secret listings.
Microsoft BitLocker TPM Initialization in Domain
First set the OU containers permissions to allow the NTSELF user of systems to write back TPM-ownerinformation, required when first initializing the TPM client:
Manage System restore and Shadow Copies from the command line
thanks to http://www.ghacks.net/2012/10/05/manage-system-restore-from-the-command-line/
Allow Users to bind machines to domains
Use the delegate Control wizard inside AD against the top level domain listing (not OU). You can then select “Join Domain” as a security option for your chosen user(s)/group(s).
Windows 2003+ domain – Prevent users adding computers to domain
1. Open run and type ADSIEDIT.msc (may need to register adsiedit.dll on server first)
WAIK Disable UAC
Addition to WAIK sysprep xml to disable UAC
adding a new user to maintenance db
add user to TABLES:
trust relationship failed, windows domain
HKLM\System\CurrentControlSet\services\Netlogon\Parameters
VBScript & Fonts on Windows 7
Some VBScript pulled from experts-exchange.com.
Mac OSX 802.1x Profile Removal
sudo mv /Library/Preferences/SystemConfiguration/com.apple.network.eapolclient.configuration.plist /Library/Preferences/SystemConfiguration/com.apple.network.eapolclient.configuration.plist.good
Create .msi from setup.exe using capture
http://www.dawnstar.com.au/wpshelp/procedures/create_np.html
Ethernet Plug Wiring
Ripped from http://lifehacker.com/how-to-wire-your-house-with-cat5-or-cat6-ethernet-cable-480020760
Linux Test Bandwidth Between Two Servers
RIPPED DIRECTLY FROM: http://linuxaria.com/article/tool-command-line-bandwidth-linux
Wise exe switches
Ripped directly from http://www.symantec.com/connect/blogs/wisescript-command-line-options
msiexec error codes
taken from http://www.msierrors.com/tag/1618/
Windows Registry Key Permissions
To take change ownership of registry keys in Windows use of the regini.exe tool seems simplest.
Multiple Local Group Policies – Windows 7
http://technet.microsoft.com/en-us/library/cc766291%28WS.10%29.aspx
PSexec Syntax
psexec SYSTEM user command prompt:
WPKG Windows Remote Software Deployment
Logical Checks:
Dell Complete Driver Listing (Enterprise CABs)
PXELinux Windows PE
The following batch file describes the creation of a Win7 PE boot environment and generates an ISO that is then bootable. For our needs we use PXELinux so note the echo in the batch file” echo Preparing peimagexfiles” below.
MySQL Commands
Export:
VMWare vCLI Errors
Getting libxml2-related errors, log out and in to refresh the environment variable changes from the install and also ensure you’re running the command prompt as an Administrator (elevated).
Product: Sophos Anti-Virus — Error 1327.Invalid Drive: h:
Encountered this problem on my client, turns out it was caused by our domain registry redirect applying to the local Windows SYSTEM account profile as well which then meant any installations running as SYSTEM were unable to unpack correctly. Correcting all references in the following user key for SYSTEM solved the problem:
MySQL ODBC 5.2.6 Driver for Windows (2008 r2)
I was unable to install the x86 or x64 MySQL ODBC driver (v5.2.6) in my Windows 2008r2 server due to a reported missing module, the exact error was:
EMIS Doctor’s Software Printing Failure
The Doctor’s EMIS software was unable to print to the Brother laserjet printer. It printed fine from Windows and other software.
Windows Automated Installation using WAIK and PXELinux
This will be a rather lengthy initial post describing the process by which I’ve:
subscribe via RSS