Windows batch remove squared brackets

@echo off
setlocal enableextensions disabledelayedexpansion

set "search1=["
set "replace1=("
set "search2=]"
set "replace2=)"

set "textFile=test.txt"

(for /f "delims=" %%i in ('type "%textFile%"') do (
    set "line=%%i"
    setlocal enabledelayedexpansion
    set "line=!line:%search1%=%replace1%!"
    set "line=!line:%search2%=%replace2%!"
    echo(!line!
    endlocal
)) > "%textFile%.tmp"

move /y "%textFile%.tmp" "%textFile%" >nul

Read all user from windows AD

Read all user from windows AD

$ExportPath = 'C:\Users\administrator\ad-export'

$groupNames = (Get-ADGroup -Filter * -SearchBase "OU=Groups,OU=Users,DC=local,DC=exmaple")

foreach ($group in $groupNames) {
$fileName = (Get-ADGroup $group | Select-Object SamAccountName | Out-String -Stream)
$fileName2 = (
$fileName.
replace('@{Name=','').
replace('}','').
replace('\','').
Replace('SamAccountName','').
Replace('----------','').
replace('\\r\\n','').
replace('\r\n','').
replace('----','').
replace(' ','')
)
$path = $ExportPath + "\" + $fileName2 + ".csv"
Get-ADGroup $group | Get-ADGroupMember -Recursive | Get-ADUser -Properties * | Select SamAccountName, Surname, GivenName, Title, Mail | Export-Csv -NoType -Encoding UTF8 -Delimiter ";" $path
}

Windows remote rename (AD) computers

# oldname, newname
$Computers = import-csv .\Rename.csv
$adminUser = Get-Credential
# "PREFIX- +" "+ $SerNum"
$Computers = Import-Csv ServerNames.csv -Header OldName, NewName
Foreach ( $Computer in $Computers ) 
{
	Rename-Computer -ComputerName $Computer.OldName -NewName $Computer.NewName -DomainCredential $adminUser -Force -PassThru
}

stuck at Install_SQLSupport_CPU64_Action

While installing SQL Server 2017 Developer Edition, I got stuck at Install_SQLSupport_CPU64_Action,
this happened to me for the second time, once at work and once at home.
The solution: You will need to browse to this installation path: C:\SQLServer2017Media\<YOUR_SQL_ENU>\1033_ENU_LP\x64\Setup
Then while the setup is stuck at Install_SQLSupport_CPU64_Action run SQLSUPPORT.msi
And follow the installation procedure.
Once installed, run the following command in cmd:
taskkill /F /FI "SERVICES eq msiserver"
The SQL Server setup will continue and succeed.

Add real emojis and icons to mintty bash on windows

Installing git for windows isn’t hard anymore. I recommend installing “Git for Windows SDK” so you can install extra packages via Pacman. I like fish shell and tmux, and those aren’t included in the default installer. Either way, you can run bash and or fish on windows. The emojis and icons however don’t look very pretty, more like DOS-style.

Open a shell and cd to

C:\Program Files\Git\usr\share\mintty\emojis or C:\git-sdk-64\usr\share\mintty\emojis depending what installation you chose.

cd C:\git-sdk-64\usr\share\mintty\
mkdir emojis
cd emojis
curl -LO https://raw.githubusercontent.com/wiki/mintty/mintty/getemojis
getemoji -d
getemoji .

In mintty:
Options -> Text -> Emojis -> style: google
Options -> Text -> Character set -> UTF-8

Posts Tagged windows

Archives by Month: