Showing all posts by xuan
Rename machine name in DOS

echo off
cls
:: by Juan Calderon 09/22
::
:: Developed as an alternative over the manual computer naming of XXXXXX[service tag]
::
:: This batch file will rename the computer using the servivce tag in BIOS.

:: find out what path the batch file is in
:: set batch_path=%~dp0

:: change drive
:: %batch_path:~0,2%

:: crop the last character and cd into it
:: cd %batch_path:~0,-1%

:: clear screen show bitlocker status
:: cls

:: WMIC computersystem where caption=’current_pc_name’ rename new_pc_name

:: pipe machine service tag to serial.txt so that later we can reverse pipe into the variable that used to name the capture file
wmic bios get serialnumber | find /v “SerialNumber” > %temp%/serial.txt

::pipe in serial
set /p serial=<%temp%\serial.txt

:: trim spaces
set serial_temp=%serial: =%

:: store serial
set serial=%serial_temp%

set current_name=%hostname%

@echo.
@echo *************************************************************************************
@echo — Renaming machine from %computername% to XXXXX%serial% —
@echo *************************************************************************************

wmic computersystem where “name=’%computername%'” call rename name=XXXXX%serial%

Posted on March 25, 2023, 11:35 am By
Categories: tech tips Tags:
Capture service tag, assset tag of Dell systems and more

echo off
cls
:: by Juan Calderon 04/22
::
:: This needs to run as admin for bitlocker to report status.
::
:: Developed as an alternative over the snipping tool
::
:: This batch file will create an informative capture of a bitlocker status once complete encryption using cap.exe dos screen capture.

::find out what path the batch file is in
set batch_path=%~dp0

::change drive
%batch_path:~0,2%

::crop the last character and cd into it
cd %batch_path:~0,-1%

::we loop until bitlocker task is 100%

echo Waiting for Bitlocker Encrytion to be 100%
:loop
::repeat until find 100%
timeout 1 > nul
echo .
manage-bde c: -status | find “100%”
if errorlevel 1 goto loop
::bitlocker done

:: clear screen show bitlocker status
cls
manage-bde c: -status

:: display information on build
echo Enginner: %HomePath%
echo Machine name: %ComputerName%

::pipe machine service tag to serial.txt so that later we can reverse pipe into the variable that used to name the capture file
wmic bios get serialnumber | find /v “SerialNumber” > %temp%/serial.txt

::pipe in serial
set /p serial=<%temp%\serial.txt

:: trim spaces
set serial_temp=%serial: =%

:: store serial
set serial=%serial_temp%

::pipe machine asset tag to asset.txt so that later we can reverse pipe into the variable that used to name the capture file
wmic systemenclosure get SMBIOSAssetTag | find /v “SMBIOSAssetTag” > %temp%/asset.txt

::pipe in asset tag
set /p asset=<%temp%\asset.txt

:: trim spaces
set asset_temp=%asset: =%

:: store asset tag
set asset=%asset_temp%

:: display system info
echo Service Tag: %serial% – Asset Tag: – %asset%
echo Users directories present:
dir c:\Users\ /b
echo Capture taken on %date%

:: capture the screen, set to 1080p
cap “Bitlocker – Service Tag %serial% – Machine %ComputerName% – Asset Tag %asset%.jpg” 0 0 1920 1080

:: create an export of all software install, diagnostic
::echo Exporting software list to “Machine %ComputerName% – Service Tag %serial% – Asset Tag %asset%.txt”
::wmic product get name, version, vendor > “Machine %ComputerName% – Service Tag %serial% – Asset Tag %asset%.txt”

 

Posted on March 25, 2023, 11:28 am By
Categories: tech tips Tags: ,
Active bitlocker using PIN with DOS

@echo off
:: Written by Juan Calderon 22/1/23
::
:: Purpose: To encrypt after MDT built to decommission.
cls

:: if the batch file is not run as admin, quit

net.exe session 1>NUL 2>NUL || (Echo This script requires admin elevated rights, exiting. & echo. & pause & Exit /b 1)

echo This script will perform the following tasks:
echo.
echo – copy new group policy files to enable bitlocker pin requirement
echo – reload the policy
echo – trigger bitlocker encryption
echo – type in the bitlocker pin 8 digits, you will not see your input, verify pin.
echo – forced reboot in 5 secs (give time for encrytion to
echo – on reboot encryption will enable, login and monitor status by clicking on key is desktray.
echo.

::find out what path the batch file is in
set batch_path=%~dp0

::crop the last character and cd into it
cd %batch_path:~0,-1%

:: change drive

cd %CD%

echo This batch file is being run from %batch_path%
echo.

 

xcopy GroupPolicy\. c:\windows\system32\GroupPolicy\ /s/e/y

gpupdate /force
::manage-bde -on C: -RecoveryKey D: -RecoveryPassword
manage-bde -protectors -add c: -pw
manage-bde -on -usedspaceonly C:
shutdown /r -t 5

Posted on March 25, 2023, 11:18 am By
Categories: tech tips Tags:
Save individual files from mailmerge

For the macro to work, you will need to add in four extra columns named: DocFolderPath, DocFileName, PdfFolderPath, and PdfFileName. These should be exactly as written here, with no spaces and each word capitalised.

Sub MailMergeToPdfBasic() ‘ Mark the start of the Subroutine (i.e. Macro) and name it “MailMergeToPdf”
‘ Macro created by Imnoss Ltd
‘ Please share freely while retaining attribution
‘ Last Updated 2021-05-03
Dim masterDoc As Document, singleDoc As Document, lastRecordNum As Long ‘ Create variables (“Post-it Notes”) for later use
Set masterDoc = ActiveDocument ‘ Identify the ActiveDocument (foremost doc when Macro run) as “masterDoc”

masterDoc.MailMerge.DataSource.ActiveRecord = wdLastRecord ‘ jump to the last active record (active = ticked in edit recipients)
lastRecordNum = masterDoc.MailMerge.DataSource.ActiveRecord ‘ retrieve the record number of the last active record so we know when to stop

masterDoc.MailMerge.DataSource.ActiveRecord = wdFirstRecord ‘ jump to the first active record (active = ticked in edit recipients)
Do While lastRecordNum > 0 ‘ create a loop, lastRecordNum is used to end the loop by setting to zero (see below)
masterDoc.MailMerge.Destination = wdSendToNewDocument ‘ Identify that we are creating a word docx (and no e.g. an email)
masterDoc.MailMerge.DataSource.FirstRecord = masterDoc.MailMerge.DataSource.ActiveRecord ‘ Limit the selection to just one document by setting the start …
masterDoc.MailMerge.DataSource.LastRecord = masterDoc.MailMerge.DataSource.ActiveRecord ‘ … and end points to the active record
masterDoc.MailMerge.Execute False ‘ run the MailMerge based on the above settings (i.e. for one record)
Set singleDoc = ActiveDocument ‘ Identify the ActiveDocument (foremost doc after running the MailMerge) as “singleDoc”
singleDoc.SaveAs2 _
FileName:=masterDoc.MailMerge.DataSource.DataFields(“DocFolderPath”).Value & Application.PathSeparator & _
masterDoc.MailMerge.DataSource.DataFields(“DocFileName”).Value & “.docx”, _
FileFormat:=wdFormatXMLDocument ‘ Save “singleDoc” as a word docx with the details provided in the DocFolderPath and DocFileName fields in the MailMerge data
singleDoc.ExportAsFixedFormat _
OutputFileName:=masterDoc.MailMerge.DataSource.DataFields(“PdfFolderPath”).Value & Application.PathSeparator & _
masterDoc.MailMerge.DataSource.DataFields(“PdfFileName”).Value & “.pdf”, _
ExportFormat:=wdExportFormatPDF ‘ Export “singleDoc” as a PDF with the details provided in the PdfFolderPath and PdfFileName fields in the MailMerge data
singleDoc.Close False ‘ Close “singleDoc”, the variable “singleDoc” can now be used for the next record when created
If masterDoc.MailMerge.DataSource.ActiveRecord >= lastRecordNum Then ‘ test if we have just created a document for the last record
lastRecordNum = 0 ‘ if so we set lastRecordNum to zero to indicate that the loop should end
Else
masterDoc.MailMerge.DataSource.ActiveRecord = wdNextRecord ‘ otherwise go to the next active record
End If

Loop ‘ loop back to the Do start
End Sub ‘ Mark the end of the Subroutine

 

 

Power settings in DOS

:: if the batch file is not run as admin, quit

net.exe session 1>NUL 2>NUL || (Echo This script requires admin elevated rights, exiting. & echo. & pause & Exit /b 1)

::find out what path the batch file is in
set batch_path=%~dp0

::crop the last character and cd into it
cd %batch_path:~0,-1%

::change drive – special way to get vairable in admin mode
echo %~d0%
%~d0%

xcopy GroupPolicy\. c:\windows\system32\GroupPolicy\ /s/e/y

pause

::pause
:: edit power plan settings

::on mains
powercfg /change monitor-timeout-ac 240
::on battery
powercfg /change monitor-timeout-dc 120

::on mains
powercfg /change standby-timeout-ac 0
::on battery
powercfg /change standby-timeout-dc 240

 

 

::——CHANGE LID SETTINGS
::https://learn.microsoft.com/en-us/windows-hardware/customize/power-settings/power-button-and-lid-settings
::https://www.elevenforum.com/t/change-power-button-action-in-windows-11.5186/

::power button

::AC on mains 3 SHUTDOWN
powercfg -setacvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 3
powercfg -SetActive SCHEME_CURRENT

::DC on battery 3 SHUTDOWN
powercfg -setdcvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 3
powercfg -SetActive SCHEME_CURRENT

::sleep button
::https://www.tenforums.com/tutorials/107766-add-remove-sleep-button-action-power-options-windows.html
::https://github.com/LinkPhoenix/Windows-10-IoT-Enterprise-Optimization/blob/master/Config%20Power%20Options%20(High%20performance).bat
::https://www.elevenforum.com/t/change-sleep-button-action-in-windows-11.5198/

::DC power battery 2 hibernate
powercfg -setdcvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 96996bc0-ad50-47ec-923b-6f41874dd9eb 2

::AC power mains 2 hibernate
powercfg -setacvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 96996bc0-ad50-47ec-923b-6f41874dd9eb 2

::powercfg -SetActive SCHEME_CURRENT

:: REG ADD “HKLM\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB” /v “DCSettingIndex” /t “REG_DWORD” /d “2” /f
:: REG ADD “HKLM\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB” /v “ACSettingIndex” /t “REG_DWORD” /d “2” /f

::CLOSE LID
::AC power battery 3 DO NOTHING
::powercfg -setdcvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
::powercfg -SetActive SCHEME_CURRENT

::DC power mains 3 DO NOTHING
::powercfg -setacvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
::powercfg -SetActive SCHEME_CURRENT

::AC on mains
powercfg /setACvalueIndex scheme_current sub_buttons lidAction 0
::DC on battery
powercfg /setDCvalueIndex scheme_current sub_buttons lidAction 0

::—- EDIT LID SETTINGS
:: TICK BOXES
::reg import “E:\admin\Fast Startup is turned off.reg”

REG ADD “HKLM\SYSTEM\ControlSet001\Control\Session Manager\Power” /v “HiberbootEnabled” /t “REG_DWORD” /d “00000000” /f

::reg import “E:\admin\Hibernate on menu.reg”
REG ADD “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings” /v “ShowHibernateOption” /t “REG_DWORD” /d “00000001” /f

powercfg.exe /hibernate on
pause

 

Posted on March 25, 2023, 11:06 am By
Categories: tech tips Tags: ,
Bandcamp

Extracting audio from them I found this type of url on footer code

Yet to decipher more…

https://t4.bcbits.com/stream/a1bf3ff8f57f8c6122842fe526ce9aec/mp3-128/1208179075?p=0&ts=1678122596&t=ab79193bfc95614eade484ba948e2d015fc04607&token=1678122596_01143f52c2374c2391457740cc512503723dce54

https://bandcamp.com/stream_redirect?enc=mp3-128&track_id=286068639&ts=1678036257&t=73dbf6a875a58358cb1ecf61ddbca7eaad3b9dc0

 

converts itself to

 

https://t4.bcbits.com/stream/896453365a3d7c4268e35e1bd5478bae/mp3-128/286068639?p=0&ts=1678123639&t=9af110e6c96d9cfc115fd92be9e33d0f8e718b64&token=1678123639_6cac1e0e851f3f78bf79b3b0f880fa0542f01bae

Posted on March 5, 2023, 5:23 pm By
Categories: tech tips Tags:
Here is a one-line batch script in MS-DOS command to check the elevated status and exit the script if the user is not an administrator.

net session >nul 2>&1 || exit

 

This script runs the net session command, which returns an error message if the user is not an administrator. The || operator allows the script to execute the exit command if the previous command returns an error code. The >nul 2>&1 redirects the output of the net session command to null so that it doesn’t display any error messages on the screen.

Posted on February 4, 2023, 7:47 pm By
Categories: tech tips Tags: ,
Find out what path a batch has been executed from

Get path

set batch_path=%~dp0

 

cd into it, remove last character

cd %batch_path:~0,-1%

 

change drive from a batch file that has been elevated
%~d0%

 

Posted on January 28, 2023, 8:02 pm By
Categories: tech tips Tags:
Command line to check if you admin rights and exit if not

net.exe session 1>NUL 2>NUL || (Echo This script requires admin elevated rights, exiting. & echo. & pause & Exit /b 1)

 

Posted on January 28, 2023, 7:51 pm By
Categories: tech tips Tags:
Steps to move WordPress to new domain

 

Step 1 – Verify that your current site is working
Step 2 – Download the files of your website
Step 3 – Export your database
Step 4 – Upload files to your new domain
Step 5 – Import your database
Step 6 – Go to wp_options
Step 7 – Update siteurl and home
Step 8 – Update connection details in wp-config
Step 9 – Check your site on your new domain
Step 10 – Fix permalinks (Optional)
Step 11 – Fix broken images (Optional)
Step 12 – Check your site again (Optional

 

Posted on January 28, 2023, 4:39 pm By
Categories: tech tips

Previous Page · Next Page