Rexxer

Some tips for me and other

News

Supermicro IPMI + Reset password

If you have physical access to the server, follow these simple steps to reset the ADMIN password on your IPMI: Create a bootable DOS USB stick using. Download the latest IPMICFG utility released by Supermicro. Extract the archive and copy the contents of the ‘DOS’ folder on to your bootable DOS USB. Boot your server […]

Replace a line in a file with SED

sed -i ‘Ns/.*/replacement-line/’ file.txt where N should be replaced by your target line number. This replaces the line in the original file. To save the changed text in a different file, drop the -i option: sed ‘Ns/.*/replacement-line/’ file.txt > new_file.txt

Powershell + Replace user’s manager

$userobj = Get-ADObject -SearchBase “DC=local, DC=com” -Filter {objectClass -eq “user” -and objectCategory -eq “person” -and manager -eq “CN=manager,DC=local,DC=com”} -Properties name, manager, department foreach ($user in $userobj) { Set-ADObject -Identity $user -replace @{“manager”=”CN=manager2,DC=local,DC=com”} write-host $user.name, $user.manager }

Windows + Remote commands

Psexec from sysinternals suite. WMIC: wmic /node:”servername” qfe get hotfixid | find “KB4012212″, wmic /node:”servername” process call create “cmd /c somecommands” Powershell, run Enable-PSRemoting-Force on the remote PC, run Test-WSMan on your PC to test the connection, run Invoke-Command -ComputerName COMPUTER -ScriptBlock { COMMAND } -credential USERNAME Enter-PSSession, as in the #3. Other tools.

BASH

Useful site about bash-scripts: http://tldp.org/LDP/abs/html/

Powershell: send and read email

In your Gmail account we have to turn the feature “Less secure app” on. To read mail I used the fine tool for PS: https://github.com/nikoblag/Gmail.ps Script example: #============================================================== # Mail function global:Send-Email ($recipient,$SSubject,$BBody) { $email = “your.mail@gmail.com” $pass = “password” $smtpServer = “smtp.gmail.com” $Credentials = New-Object System.Management.Automation.PSCredential -ArgumentList $email, $($pass | ConvertTo-SecureString -AsPlainText -Force) $From […]

CRM 2011 + copy for staging

How to copy Microsoft CRM 2011 organization on the same server. There are many reasons to copy organizations, one of the most common – for testing purpose. You can do as following: Select a database in SQL Server Management Studio which will be copied (TEST_MSCRM). Right click on the target database -> Tasks -> Backup. […]

DNS server + memory consumption

In Windows Server 2008 R2 or older OS with MS08-037 patch installed, DNS server (dns.exe) consumes ridiculously large amount of precious memory. Under the hood, dns.exe opens more than 5000 UDP ports during start up, 2500 for UDP IPv4, 2500 for UDP IPv6.  Large amount of kernel memory is also allocated for these ports.  This can […]

Windows 10 + cannot install Intel Haxm + No VT detection

Disable the group policy setting that was used to enable Credential Guard.On the host operating system, click Start > Run, type gpedit.msc, and click Ok. The Local group Policy Editor opens. Go to Local Computer Policy > Computer Configuration > Administrative Templates > System > Device Guard > Turn on Virtualization Based Security. Select Disabled. […]

Extract a text between delimiters with sh instead of using regex

Example file: UNKNOWN[123.21.181.4] abts-tn-dynamic-161.155.174.122.airtelbroadband.in[122.174.155.161] fm-dyn-118-137-18-160.fast.net.id[118.137.18.160] UNKNOWN[118.69.71.76] ip-177.71.93.43.juniornet.psi.br[177.71.93.43] UNKNOWN[210.245.34.254] UNKNOWN[185.140.242.41] I want to extract IP-addresses: command shell: cat drop.txt | cut -d'[‘ -f2 | cut -d’]’ -f1 Get data from the file Delete all the text before the delimeter (we choose the text after the delimiter) Delete alle the text after the delimeter ( … before […]

Previous Posts