donderdag 6 november 2014

Powershell - Split large files

#############################################
# Split a log/text file into smaller chunks #
#############################################
#
# WARNING: This will take a long while with extremely large files and uses lots of memory to stage the file
#

# Set the baseline counters
#
# Set the line counter to 0
$linecount = 0
# Set the file counter to 1. This is used for the naming of the log files
$filenumber = 1

# Prompt user for the path
$sourcefilename = Read-Host "What is the full path and name of the log file to split? (e.g. D:\mylogfiles\mylog.txt)"

# Prompt user for the destination folder to create the chunk files
$destinationfolderpath = Read-Host "What is the path where you want to extract the content? (e.g. d:\yourpath\)"

Powershell v3 cmdlets

#enable psremote through psexec
psexec \\[computer name] -u [admin account name] -p [admin account password] -h -d powershell.exe "enable-psremoting -force"

#enable ping through firewall
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow

#enable script running policy
Set-ExecutionPolicy RemoteSigned

#search an user in your domain
Get-ADUser -Filter {name -like 'name*'}

#search every locked account in domain
Search-ADAccount -lockedout -UsersOnly| format-table  userprincipalname, name, passwordexpired, lastlogondate

#unlock account
Unlock-ADAccount username -Confirm

#to get all groups that a user is member of
Get-ADprincipalgroupmembership username| select name

#change computer hostname in domain
Rename-Computer -ComputerName Srv01 -NewName Server001 -DomainCredential domain\username 
Force -PassThru -Restart

woensdag 4 december 2013

MS Outlook 2010 - Could not create the work file

probleem: When starting Outlook, I get the following error message “Outlook could not create the work file. Check the temp environment variable.”

Outlook could not create the work file

oplossing: