Showing posts with label Command. Show all posts
Showing posts with label Command. Show all posts

Oct 3, 2024

Command : Rename Multiple Files via Batch Script

Rename multiple files via batch script. Some times you need to rename multiple files and instead of renaming each file individually or relying on some 3rd party apps, you can now just use a simple batch script to achieve the same results.




@echo off
setlocal enabledelayedexpansion

set prefix="[Filename]"
set count=1

for %%f in (*.[Extension]) do (
    set formattedCount=00!count!
    set formattedCount=!formattedCount:~2!

    ren "%%f" "!prefix!!formattedCount!.[Extension]"
    set /a count+=1
)

echo Done renaming files.
pause



!!! HAPPY COMPUTING !!!

Jul 18, 2024

Windows : DISM Error "0x800f081f"

Fixing the DISM Error "0x800f081f". Depending on what you are trying to achieve, in my case is the failure of installing .NET Framework 3.5 in Windows Server 2012 R2 Std 64-bit.

The error message :


Error: 0x800f081f

The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077.

The DISM log file can be found at C:\Windows\Logs\DISM\dism.log



1. Check the Windows Protected files scan.

sfc /scannow

Results with error :


Beginning system scan. This process will take some time.

Beginning verification phase of the system scan.
Verification 100% complete.

Windows Resource Protection found corrupt files but was unable to fix some of them. Details are included in the CBS.Log windir\Logs\CBS\CBS.log. For example C:\Windows\Logs\CBS\CBS.log. Note that logging is currently not supported in offline servicing scenarios.



2. Scan the image with dism.

dism /online /cleanup-image /scanhealth

Results with error :


Deployment Image Servicing and Management tool
Version: 6.3.9600.19408

Image Version: 6.3.9600.19397

[==============================100.0%============================]

Error: 0x800f081f

The source files could not be found. Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077.

The DISM log file can be found at C:\Windows\Logs\DISM\dism.log



3. Repairing the files.

dism /online /cleanup-image /restorehealth /source:D:\sources\install.wim /limitaccess


4. Once completed, restart the computer and proceed to install the .NET Framework 3.5

dism /online /enable-feature /featurename:NetFX3 /All /Source:D:\sources\sxs /LimitAccess


5. Once done, restart the computer again and the new features is already installed.


!!!HAPPY COMPUTING !!!


Nov 27, 2023

Ubuntu : Change NTP Server

At times it is recommended to change the NTP server for a more accurate Time Sync. This is to ensure all servers have the same Date, Time and Zone.



$ sudo nano /etc/systemd/timesyncd.conf


Add or modify the following line and save the file :-


NTP=time.google.com


Next, restart the time service :-


$ sudo systemctl restart systemd-timesyncd


If required, you can check whether the time server can be contacted :-


$ sudo cat /var/log/syslog | grep systemd-timesyncd


Verify the NTP connections :-


$ sudo timedatectl show-timesync | grep ServerName



!!! HAPPY COMPUTING !!!

Nov 8, 2023

Batch : Rename Hostname via Batch File

This is an example of a batch file to rename the Hostname or Computer Name as per your preferences, it is much faster way to do computer renaming for many computers.

Note that the batch file must be "run as administrator" mode in order to works.

 @ECHO OFF
CLS
>NUL CHCP 65001

:asktorename
REM To ask whether to Rename the Hostname or not.
ECHO.
ECHO.
ECHO.
ECHO               ╔═════════════════════════════════════════╗
ECHO               ║         RENAMING THE HOSTNAME           ║
ECHO               ╚═════════════════════════════════════════╝
ECHO.
CHOICE /M "──────────────► DO YOU WANT TO RENAME THE HOSTNAME "
    IF ERRORLEVEL 2 GOTO eof
    IF ERRORLEVEL 1 GOTO askforname
GOTO eof
REM --------------------------------------------------------------------------------------

:askforname
REM To ask User for the preferred hostname.
ECHO.
ECHO.
SET /P NEWNAME="PLEASE TYPE THE NEW HOSTNAME: "
ECHO.
ECHO "     ► ► ► THE NEW HOSTNAME IS ───► %NEWNAME%"
CHOICE /M "     ► ► ► IS THIS CORRECT "
    IF ERRORLEVEL 2 GOTO asktorename
    IF ERRORLEVEL 1 GOTO dorenhost
GOTO eof
REM --------------------------------------------------------------------------------------

:dorenhost
REM To proceed Rename the Hostname as per Input by User.
ECHO.
ECHO "     ► ► ► OK, RENAMING HOSTNAME → %NEWNAME%, PLEASE WAIT..."
WMIC COMPUTERSYSTEM where name="%COMPUTERNAME%" CALL RENAME name="%NEWNAME%"
TIMEOUT /t 3 /NOBREAK
ECHO.
ECHO "     ► ► ► RENAMING HOSTNAME COMPLETE"
ECHO.
ECHO "THE NEW HOSTNAME WILL TAKE EFFECT AFTER COMPUTER RESTART"
TIMEOUT /t 5 /NOBREAK
GOTO eof
REM --------------------------------------------------------------------------------------

:eof
START SHUTDOWN /r /f /t 10
COLOR
>NUL CHCP 437
EXIT /b



!!! HAPPY COMPUTING !!!

Sep 15, 2023

Windows 11 : Built-In Apps that can be Remove

Windows 11 comes bundled with a some Apps that may or may not be needed in a Corporate environment, these may include App such as Xbox, Video Editor etc.

But removing all those unnecessary Apps maybe troublesome, and worst breaking the "SysPrep" function and further preventing for a mass deployment.

Below are the few Apps that can be removed safely without breaking "SysPrep" functionality. You will need to remove script lines for App(s) that you want to retain.

Copy and save the file as PowerShell Script (.ps1).

 

Write-Host
Write-Host
Write-Host "**************************"
Write-Host "* Removing Appx Packages *"
Write-Host "**************************"
Write-Host
Write-Host "Removing Zune Video..."
Get-AppxPackage -AllUsers *ZuneVideo* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Zune Music..."
Get-AppxPackage -AllUsers *ZuneMusic* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Microsoft Your Phone..."
Get-AppxPackage -AllUsers *YourPhone* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Xbox Speech..."
Get-AppxPackage -AllUsers *XboxSpeech* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Xbox Identity..."
Get-AppxPackage -AllUsers *XboxIdentity* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Xbox Gaming Overlay..."
Get-AppxPackage -AllUsers *XboxGamingOverlay* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Xbox Game Overlay..."
Get-AppxPackage -AllUsers *XboxGameOverlay* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Xbox App..."
Get-AppxPackage -AllUsers *XboxApp* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Xbox TCUI..."
Get-AppxPackage -AllUsers *Xbox.TCUI* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Windows Maps..."
Get-AppxPackage -AllUsers *WindowsMaps* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Windows Feedback Hub..."
Get-AppxPackage -AllUsers *WindowsFeedbackHub* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Windows Communications Apps..."
Get-AppxPackage -AllUsers *windowscommunicationsapps* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Windows Alarms..."
Get-AppxPackage -AllUsers *WindowsAlarms* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Microsoft People..."
Get-AppxPackage -AllUsers *Microsoft.People* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Solitaire Collection..."
Get-AppxPackage -AllUsers *MicrosoftSolitaireCollection* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Office Hub..."
Get-AppxPackage -AllUsers *MicrosoftOfficeHub* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Windows Get Started..."
Get-AppxPackage -AllUsers *GetStarted* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Windows Get Help..."
Get-AppxPackage -AllUsers *GetHelp* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Bing Weather..."
Get-AppxPackage -AllUsers *BingWeather* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Microsoft Gaming App..."
Get-AppxPackage -AllUsers *GamingApp* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Microsoft Bing News..."
Get-AppxPackage -AllUsers *BingNews* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Microsoft Teams App..."
Get-AppxPackage -AllUsers *MicrosoftTeams* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Microsoft To Dos App..."
Get-AppxPackage -AllUsers *Microsoft.Todos* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Microsoft Power Automate Desktop App..."
Get-AppxPackage -AllUsers *Microsoft.PowerAutomateDesktop* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Microsoft ClipChamp App..."
Get-AppxPackage -AllUsers *Clipchamp* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host "Removing Microsoft Windows Terminal App..."
Get-AppxPackage -AllUsers *WindowsTerminal* | Remove-AppxPackage
Start-Sleep -s 5
Write-Host
Write-Host "Uninstallation of AppxPackages Completed."
Start-Sleep -s 5 
Write-Host
Write-Host
Write-Host "**************************************"
Write-Host "* Removing Appx Provisioned Packages *"
Write-Host "**************************************"
Write-Host
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Zune Video..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.ZuneVideo_2019.22091.10041.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Zune Music..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.ZuneMusic_11.2305.4.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Microsoft Your Phone..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.YourPhone_1.22022.147.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Xbox Speech..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.XboxSpeechToTextOverlay_1.17.29001.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Xbox Identity..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.XboxIdentityProvider_12.50.6001.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Xbox Gaming Overlay..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.XboxGamingOverlay_2.622.3232.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Xbox Game Overlay..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.XboxGameOverlay_1.47.2385.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Xbox TCUI..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.Xbox.TCUI_1.23.28004.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Windows Maps..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.WindowsMaps_2022.2202.6.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Windows Feedback Hub..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.WindowsFeedbackHub_2022.106.2230.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Windows Communications Apps..."
Remove-AppxProvisionedPackage -Online -PackageName microsoft.windowscommunicationsapps_16005.14326.20544.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Windows Alarms..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.WindowsAlarms_2022.2202.24.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Microsoft People..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.People_2020.901.1724.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Solitaire Collection..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.MicrosoftSolitaireCollection_4.12.3171.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Office Hub..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.MicrosoftOfficeHub_18.2204.1141.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Windows Get Started..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.Getstarted_2021.2204.1.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Windows Get Help..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.GetHelp_10.2201.421.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Bing Weather..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.BingWeather_4.53.33420.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Microsoft Gaming App..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.GamingApp_2021.427.138.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Microsoft Bing News..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.BingNews_4.2.27001.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Microsoft Teams..."
Remove-AppxProvisionedPackage -Online -PackageName MicrosoftTeams_23231.411.2342.9597_x64__8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Microsoft Power Automate Desktop App..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.PowerAutomateDesktop_10.0.3735.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Microsoft ClipChamp App..."
Remove-AppxProvisionedPackage -Online -PackageName Clipchamp.Clipchamp_2.2.8.0_neutral_~_yxz26nhyzhsrt
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Microsoft To Dos App..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.Todos_2.54.42772.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host "Removing AppxProvisioned Microsoft Windows Terminal App..."
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.WindowsTerminal_3001.12.10983.0_neutral_~_8wekyb3d8bbwe
Start-Sleep -s 5
Write-Host
Write-Host
Write-Host "*******************************************************"
Write-Host "* Uninstallation of AppxProvisionedPackage Completed. *"
Write-Host "*******************************************************"
Start-Sleep -s 5
EXIT

 

 


!!! HAPPY COMPUTING !!!

Sep 5, 2023

Windows : Get Operating System Info in Command Prompt

How to get the installed Operating System information via the Command Prompt.

1. To get OS Architecture type.

wmic os get OSArchitecture



2. To get OS Edition info.

wmic os get Caption /value



3. To get OS CD-Key info.

wmic path softwareLicensingService get OA3xOriginalProductKey



!!! HAPPY COMPUTING !!!

Aug 30, 2023

Windows Terminal : Always Run as Administrator

How to Enable Windows Terminal to always "Run as Administrator" option.

1) Open --> Windows Terminal

2) Goto --> Settings

3) Under "Profile" section, select which profile you want to enable, in this case select --> Command Prompt

4) On the right-pane, scroll down and search for --> Run this profile as Administrator = On


!!! HAPPY COMPUTING !!!

Aug 11, 2023

Windows 10 : Delete Recovery Partition

Windows 10 "Recovery" partition is a special partition on system hard drive and is used to restore the system to factory settings in the event of system issues. To protect the recovery partition from being changed or deleted, the recovery partition usually doesn't have any drive letter assigned and other features or options are not available in Disk Management.

This "Recovery" partition can be deleted and it will not impact your existing Windows 10 OS. Though it can be deleted but to delete it, you must follow this steps.


NOTE : IT IS RECOMMENDED NOT TO DELETE THIS PARTITION ! DOING SO, YOU WILL NOT HAVE ANY LAST RESORTS IN THE EVENT OF OS ISSUES.



1. Run --> CMD (run as admin)

2. Type --> diskpart

3. Type --> list disk

4. Type --> select disk [number]
     (usually primary disk number is 0)

5. Type --> list partition

6. Type --> select partition [number]
     (in this case my, based on my drive's partition layout, the number is 4)

7. Type --> delete partition override

8. Type --> exit

9. Now, open "Disk Management" and you will notice that now there is a "Unallocated" space available in the drive.

10. Next step is to extend your [C:] drive by right-click --> Extend volume.

11. Ensure the full size is selected and click --> Next

12. Verify the new configuration and click --> Finish

Now you will have a larger capacity of the [C:] drive partition.


!!! HAPPY COMPUTING !!!

Apr 17, 2023

Windows : Terminal Apps (Shortcut Keys)

 Windows Terminal Apps Shortcut Keys

Download Link : https://github.com/microsoft/terminal


General Shortcuts.

  • [CTRL] +[SHIFT] + [W] --> Close Current Pane.
  • [CTRL] + [-] --> Reduce Font Size.
  • [CTRL] + [+] --> Increase Font Size.
  • [CTRL] + [0] --> Reset Font Size to Default.


Tabs, Pane and Windows Shortcuts.

  • [CTRL] + [SHIFT] + [T] --> Open New Tab with Default Profile.
  • [CTRL] + [SHIFT] + [N] --> Open New Window.
  • [CTRL] + [SHIFT] + [1 ~ 9] --> Open New Tab with Corresponding profile Index (eg. 1 to 9).
  • [ALT] + [SHIFT] + [D] --> Duplicate a Pane.
  • [CTRL] + [SHIFT] + [D] --> Duplicate a Tab.
  • [ALT] + [SHIFT] + [-] --> Split Pane Horizontally.
  • [ALT] + [SHIFT] + [+] --> Split Pane Vertically.

!!! HAPPY COMPUTING !!!

Jan 5, 2023

Batch : Rename Hostname

 Inside batch file, create the following command line to rename the current computer with a new hostname.

WMIC COMPUTERSYSTEM where name="%COMPUTERNAME%" CALL RENAME name="%NEWPCNAME%"

Need to restart computer to take effect.


!!! HAPPY COMPUTING !!!


Dec 15, 2022

Exchange Server 2016 : Command Line

1. Get-ExchangeServer | Format-List Name,Edition,AdminDisplayVersion

2. Get-MailboxDatabase -Status | Select Name,LastFullBackup

3. Get-AuthConfig | fl CurrentCertificateThumbPrint

4. Get-ExchangeCertificate


Aug 17, 2022

LUBUNTU : Command Line

 LUBUNTU v.20.04.1 64-bit : Command Line

1. sudo apt update

2. sudo apt upgrade -y

3. sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

4. sudo dpkg -i ~/downloads/google-chrome-stable_current_amd64.deb

5. sudo apt install fonts-liberation


Apr 27, 2022

Batch - IF Calculation

 Batch File Command "IF"

  • EQU = Equal to...
  • NEQ = Not Equal to...
  • LSS = Less than...
  • LEQ = Less than or Equal to...
  • GTR = Greater than...
  • GEQ = Greater than or Equal to...
Example :-

IF %INPUT% EQU 100 ECHO "EQUAL VALUE"
IF %INPUT% GEQ 100 ECHO "VALUE IS GREATER THAN OR EQUAL TO 100"

Apr 5, 2021

CentOS v.7 : List Existing User & Login History

To get User Listing.

 [root@server~]# get ent passwd

OR

[root@server~]# less /etc/passwd

OR

[root@server~]# cut -di -f1 /etc/passwd


To get Login History.

[root@server~]# last -120

OR

[root@server~]# cat /var/log/secure         *The "secure" file may have corresponding date.


Dec 24, 2020

CentOS v.7 : Enabled/Disabled GUI at Boot-up

 CentOS v.7.0 : Enabled/Disabled GUI from Boot-up.

Enabled

  1. systemctl get-default
  2. systemctl set-default graphical.target
  3. startx

Disabled
  1. systemctl isolate graphical.target
  2. systemctl set-default multi-user.target

Feb 5, 2017

Windows 10 - Remove Provisioned Apps

This is my second post about Windows 10 built-in apps (Provisioned Apps), some of us just don't like the built-in apps... just like the ridiculous Xbox apps which I find it to be best at hogging system resources.

Now my last post was to remove those built-in apps, but later I found it was still in Windows 10 when another user logged-in. After much googling and studying MSDN and TechNet, I found a powershell script and I wrote some sample of my own.

First of all, you still need to run the previous powershell script to ensure that all users are not provisioned with the built-in apps, just in case I have re-posted those script here for your references.


Get-AppxPackage -allusers *3dbuilder* | Remove-AppxPackage
Get-AppxPackage -allusers *windowsalarms* | Remove-AppxPackage
Get-AppxPackage -allusers *zunevideo* | Remove-AppxPackage
Get-AppxPackage -allusers *officehub* | Remove-AppxPackage
Get-AppxPackage -allusers *skypeapp* | Remove-AppxPackage
Get-AppxPackage -allusers *getstarted* | Remove-AppxPackage
Get-AppxPackage -allusers *zunemusic* | Remove-AppxPackage
Get-AppxPackage -allusers *solitairecollection* | Remove-AppxPackage
Get-AppxPackage -allusers *bingfinance* | Remove-AppxPackage
Get-AppxPackage -allusers *bingnews* | Remove-AppxPackage
Get-AppxPackage -allusers *people* | Remove-AppxPackage
Get-AppxPackage -allusers *windowsphone* | Remove-AppxPackage
Get-AppxPackage -allusers *commsphone* | Remove-AppxPackage
Get-AppxPackage -allusers *bingsports* | Remove-AppxPackage
Get-AppxPackage -allusers *windowsstore* | Remove-AppxPackage
Get-AppxPackage -allusers *bingweather* | Remove-AppxPackage
Get-AppxPackage -allusers *xboxapp* | Remove-AppxPackage
Get-AppxPackage -allusers *twitter* | Remove-AppxPackage
Get-AppxPackage -allusers *office.sway* | Remove-AppxPackage
Get-AppxPackage -allusers *xboxonesmartglass* | Remove-AppxPackage
Get-AppxPackage -allusers *messaging* | Remove-AppxPackage

Note : You can choose which apps you want to retain back. 

After you have completed the above script, now you can run the 2nd script as below, also you can choose which apps you want to retain back.


Remove-AppxProvisionedPackage -online -packagename Microsoft.3DBuilder_11.0.47.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.BingWeather_4.9.51.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.Getstarted_3.11.3.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.Messaging_2.7.1001.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.MicrosoftOfficeHub_2015.6801.23751.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.MicrosoftSolitaireCollection_3.9.5100.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.Office.OneNote_2015.6868.57981.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.OneConnect_1.1605.17.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.People_2016.709.155.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.People_2016.709.155.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.SkypeApp_11.4.86.0_neutral_~_kzf8qxf38zg5c
Remove-AppxProvisionedPackage -online -packagename Microsoft.StorePurchaseApp_1.0.454.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.WindowsAlarms_2016.622.2118.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename microsoft.windowscommunicationsapps_2015.6868.41201.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.WindowsFeedbackHub_1.3.1741.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.WindowsMaps_2016.701.2235.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.WindowsStore_11606.1001.394.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.XboxApp_2016.623.248.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.XboxIdentityProvider_2016.616.818.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.ZuneMusic_2019.6.19261.0_neutral_~_8wekyb3d8bbwe
Remove-AppxProvisionedPackage -online -packagename Microsoft.ZuneVideo_2019.6.19281.0_neutral_~_8wekyb3d8bbwe

 
After completion, you just need to restart the computer. Please be aware that if an apps was still provisioned to a user, you cannot remove that apps. As such it is important that you ensure no users is still requiring that apps before removing.

I find this to be useful especially when you want to create a consistent operating environment (COE) for a corporate/enterprise system.

!!! HAPPY SCRIPTING !!!
!!! HAPPY CHINESE NEW YEAR !!!

Jun 22, 2015

Batch - Join Domain Batch File

This is a batch file to automatically join the computer to the specified domain, the purposes of the batch file as below :-

  • To avoid typography error in domain name.
  • To avoid mismatch username and password when joining to domain.
Syntax of the command :
 
netdom join %COMPUTERNAME% /domain:[domain name] /userd:[domain\username] /passwordd:[password]

 
  • %COMPUTERNAME% = Computer's Name, a variables.
  • [domain name] = The actual domain name (eg. google.com)
  • [domain\username] = The actual domain's username (eg. google.com\administrator)
  • [password] = The username's password.
Of course you can put in a lot of things into this batch file such as checking the computer's name validity (eg. length of the name, cross checking with a database file to match the S/N etc.)

Note that the "netdom" command is NOT AVAILABLE in standard Windows 7 OS, it must be installed separately. Download & install Microsoft Remote Server Administration Tools (RSAT).

Once installed you need to enable the "AD DS Command-Line Utility" before you can start using the "netdom" command.

Jun 1, 2015

Batch - Verify Model & Install Drivers

The following batch file are to check whether the supported model is valid or not and if valid will proceed to next step which is "valid" in this case.

Subsequent batch command is to call the HP SSM built-in command to install the respective drivers automatically.

 
REM Check for valid model & proceed to install.
SET INPUT=Model
for /f "tokens=1,* delims==" %%i IN ('wmic computersystem get %INPUT% /VALUE ^| FIND /I "%INPUT%="') do set Model=%%j
 
ECHO   Found the following model : %Model%
 
IF "%Model%" EQU "HP Compaq 6200 Pro SFF PC" GOTO valid
IF "%Model%" EQU "HP Compaq Pro 6300 SFF" GOTO valid
IF "%Model%" EQU "HP Elite 8300 USDT" GOTO valid
IF "%Model%" EQU "HP ProDesk 600 G1 SFF" GOTO valid
IF "%Model%" EQU "HP EliteDesk 800 G1 SFF" GOTO valid
IF "%Model%" EQU "HP EliteBook 2560p" GOTO valid
IF "%Model%" EQU "HP ProBook 6470b" GOTO valid
IF "%Model%" EQU "HP EliteBook 2570p" GOTO valid
IF "%Model%" EQU "HP EliteBook Folio 9470m" GOTO valid
IF "%Model%" EQU "HP ProBook 640 G1" GOTO valid
IF "%Model%" EQU "HP EliteBook 820 G1" GOTO valid
IF "%Model%" EQU "HP EliteBook 840 G1" GOTO valid
IF "%Model%" EQU "HP EliteBook 1040 G1" GOTO valid
IF "%Model%" EQU "HP Z230 SFF Workstation" GOTO valid

 
Please take note that the model name are {CASE SENSITIVE} and thus extra care required when typing the model name into the batch file.

May 29, 2015

Batch - Consistent Operating Environment

Consistent Operating Environment (COE), does anyone really understand what is this means ?

To my understanding, COE means that all computers must be running on a same OS, same applications/programs, same interface and same settings/configurations.

It is very hard achieve and yet simple to implement, the most troublesome thing is to make it compatible with all kind of models. Put it simple (using HP's model series and ranges), a single image to cater for almost all types of models yet the ability to install it's own drivers, applications etc. and make it function/working.

Luckily HP (Hewlett-Packard) does have a tools to help us in this tasks, but drawback would be custom scripting/batch file(s) have to be created & tested to ensure the workability of it.

It is called the SSM (Softpaq System Manager), what this tools does is to ensure the reliability of the downloaded drivers and the ability to differentiate the models being install and subsequently install the relevant drivers for the system.

I'm in the midst of compiling a "Universal Master Image" capable of installing the drivers base on the models detected and of course the customised settings required for the specific corporate environment.

Although I can't disclose much details of it, but I will post the scripts and hopefully might be usefull to someone.