News
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.
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 […]
Zabbix + reset password for the web interface
update zabbix.users set passwd=md5(‘mynewpassword’) where alias=’Admin’;
Windows 7 + shell commands for consoles
Shell commands list for Windows 7 Обнаружение беспроводных сетей – rundll32.exe van.dll,RunVAN Настройка беспроводной сети – RunDll32.exe shell32.dll,Control_RunDLL NetSetup.cpl,@0,WNSW Управление беспроводными сетями – explorer.exe shell:::{1fa9085f-25a2-489b-85d4-86326eedcd87} Архивация и восстановление – sdclt.exe /restorewizardadmin Восстановление файлов – sdclt.exe /restorewizard Настройка системы архивации – sdclt.exe /configure Добавление сетевого расположения – rundll32.exe shwebsvc.dll,AddNetPlaceRunDll Параметры индексирования – control.exe srchadmin.dll Настройка значков […]