Rexxer

Some tips for me and other

Powershell + Get users from specified groups

$Groups = “ip”,”team”,”Managment”,”mott” ForEach ($Group in $Groups) { write-host “#” write-host “Group:” $Group write-host “===============================” $gr = Get-ADGroupMember -identity $group echo $gr.name write-host “===============================” }

Gitlab + Change the notification for new users

Edit the following files: /opt/gitlab/embedded/service/gitlab-rails/app/views/notify new_user_email.text.erb new_user_email.html.haml Then run gitlab-ctl reconfigure

Powershell + Logoff inactive users

We have shared PCs and some people leave their sessions locked. Their audio processes (Skype, players, etc …) still work and it’s the problem. I wrote the script which runs at a user logon and logoff these inactive users. function Get-Sessions { $queryResults = query session $starters = New-Object psobject -Property @{“SessionName” = 0; “UserName” […]

Powershell + Time elapsed

$sw = [Diagnostics.Stopwatch]::StartNew() ping -l 10 192.168.2.2 $sw.Stop() $sw.Elapsed $res = “Elapsed: ” + $sw.Elapsed.Hours + ” hours ” + $sw.Elapsed.Minutes + ” minutes ” + $sw.Elapsed.Seconds + ” seconds” echo $res

Windows 10 + .Net 3.5 install issue

Following command can be used to install .NET 3.5 on Windows 10 without internet connection: Dism.exe /online /enable-feature /featurename:NetFX3 /source:F:\sources\sxs /LimitAccess Where, F: is your installation media. Also, there’s tool to install .NET 3.5 offline from your existing Windows 10 installation media: http://www.techgainer.com/tools/net-framework-3-5-offline-installer-windows-10-8-x/ Source: http://answers.microsoft.com/en-us/insider/forum/insider_wintp-insider_install/how-to-instal-net-framework-35-on-windows-10/450b3ba6-4d19-45ae-840e-78519f36d7a4

Grep + Parse IPs

grep -o ‘[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}’ file.txt

Logoff inactive users

The first variant: use winexit.scr from Windows 2003 Toolkit. The minus: it doesn’t help if a user lock his account and another user is switched. The plus: there is an announcement and countdown. The worked solution: use iddlelogoff.exe from Intelliadmin (free): Download http://www.intelliadmin.com/idlelogoff.exe Open Group Policy Managment console and create a new policy for an […]

Powershell + turn on system protection

enable-computerrestore -drive “c:\” vssadmin resize shadowstorage /on=c: /for=c: /maxsize=3%

Create UEFI booting flash

run diskpart and: select disk N clean create partition primary format fs=fat32 quick active assign list volume exit Copy Win10 files from ISO to flashdrive.

FTP-log + get IP-addresses

cat ftp.txt | grep incorrect | awk ‘{print $8};’ | tr -d “(” | tr -d “)>” | sort -u

Previous Posts Next posts