Saturday 3 November 2018

Error :ConvertToTransactional Customer (CustomerAxCustomer)

Getting Error in POS "AX Retail POS error_13000- couldn't load all external service modules"
and in Event Viewer "Microsoft.Dynamics.Retail.POS.DataManager.CustomerDataManager.Converttotransactional Customer(CustomerAxCustomer)"


Solution: Check the Default Customer address book in customer(AR) as well into the Retail Channel. If missing then edit and put proper address book, if it is already there then reedit and then sync database.

Friday 26 October 2018

Add New Tables into Store database and configure in the P-Jobs in AX Retail

Configure Pull (P) jobs for newly created Tables into Channel/AX database
  1. Create Table with Dataareaid
  2. Retail Channel Schema
  3. Scheduler Sub Jobs
  4. Scheduler Jobs 
  5. Retail Parameter -Initialise
  6. Retail Scheduler Parameters -Sync Metadata
  7. Run P-0001 Job/New Job
*Retail > Setup >Retail Scheduler



* Retail Channel Schema 


* Select AX 2012 R3 Go to Location Tables


* Click on New add desired table with prefix ax. then click on Location Fields


 * Click on New Add Table fields as below then close


* After that run on generate classes

*Click OK




* After Retail Channel Schema Go to the Scheduler sub jobs


* Follow below Screen shot Sequence accordingly


* Click on Functions then click Match Fields.


 * After that Go to the Scheduler Jobs


* Click on P Job(Channel Transactions) Add Table then click on create staging table



* After that again go to the Retail Channel Schema Click on Generate Classes


* After Generate Classes go to the Retail Parameter Click Intialise
* After the Go to the Retail Scheduler Parameter then Sync Metadata , Finally run P Job for Sync data.

Thursday 25 October 2018

Violation of PRIMARY KEY constrain. Cannot insert duplicate key in object ‘ax.RETAILTRANSACTIONTABLE’

Getting Error at the time of billing at POS "Violation of PRIMARY KEY constraint 'I_-1558077251_-1679712867'.Cannot insert duplicate key in object 'ax.RETAILTRANSACTIONTABEL'.The duplicate key value is (XX,XXX,XXXXXX,XXXX,cri). The statement has been terminated."


To void such error, try to setup the CDX components so that the transaction at POS sync to AX. Use the above form to calculate POS number sequence and push this data using 1160 job back to POS. Once the data is updated to POS, it will start creating transaction based on next number.

Retail > Periodic > Retail POS Redeployment 


This store procedure also returns the current numbers to be used for the fields TransactionID, ReceiptID
 in the table “ax.RETAILTRANSACTIONTABLE”. The P-job sends the data periodically from this table to back office (AX) in the equivalent table “RetailTransactionTable”

 In order to view the current seed data, Go to Retail>Periodic>Retail POS Redeployment form.



In order to calculate the POS number sequence details for a register, create a new record and select the store and register.  Click the button “Calculate POS number sequence”. This will call a static method in the RetailPOSSeedData to calculate the current used numbers for different data type.
You may edit this numbers using “Edit POS number seq..” and set new numbers and push the data back to POS. Use the scheduler job 1160 (POS redeployment) to perform this.  Based on this, a new number sequence will be generated in the POS. But, if the “ax.RETAILTRANSACTIONTABLE” has already a records with same number POS transaction will not take palce successfully due to duplicate key error as follows:

Violatio  of PRIMARY KEY constrain. Cannot insert duplicate key in object ‘ax.RETAILTRANSACTIONTABLE’.

Monday 22 October 2018

Retail POS Shift is not Closing showing Error

Problem :-
When Retail POS had an issue closing a shift, the shift could be stuck in an Open and Closed state. The shift for the terminal is in the CRT.RETAILSHIFTSTAGINGTABLE  having transactions as an open shift and the AX.RETAILPOSBATCHTABLE having transactions as a closed shift.  When the shift for a terminal is in this state, the shift could not be closed, and a new shift could not be open.



Solution :-

Run Below Query into Store Database table :-

Truncate Table CRT.RETAILSHIFTSTAGINGTABLE

Number Sequence Blocking other posting process + AX 2012 R3

To find number sequence

SELECT * FROM NumberSequenceList WITH (READUNCOMMITTED)
WHERE EXISTS (SELECT RecId FROM NumberSequenceTTS WITH (READUNCOMMITTED) where NumberSequenceTTS.TRANSID = NumberSequenceList.TRANSID)
AND TRANSID != 0

tells us the lock is related to the TOB number sequence ... which is set to continuous .. but shouldn't be (or it is not strictly required anyway).

Solution :

So the problem here is a number sequence that was set to be continuous and several processes fetching a new number from this number sequence simultaniously.

It is advised to make this specific number sequence not continuous and review all other continuous number sequences.

Saturday 20 October 2018

Statement Posting/Calculation Error :- Conversion of Mode of Delivery Code Was not Specified

If you are getting Statement Posting/Calculation Error :- "Conversion of Mode of Delivery Code Was not Specified"


This is because of customer inter company Active, remove the active tick then calculate/post
Navigation :- Account Receivable - Common -All Customer then Click on General Tab -Set Up tab click on inter company.   


Tuesday 16 October 2018

How to Configure Retail Credit Memo to All Legal Entity Stores

Configure Credit Memo to  accept all Retail Stores, which is issued by other legal entity store, there are some work around to configure Credit Memo as given below

Steps:- We have to login with single user if more than one user then you can not create table collection , Ctrl +D go to the AOT in Data Dictionary Expend it Go to the Table Collection right click on New Table Collection


To create a table collection, go to AOT\Data Dictionary\Table Collections and on right click select "New Table Collection", then just drag RETAILCREDITVOUCHERTABLE  in this collection.


After Create Table collection go to the AX--System Administrator click on Virtual Company Account click on New give the company account, which will be in RETAILCREDITVOUCHERTABLE as DataAreaId , which allow the records to show in all legal entity.


After create virtual company accounts, select company account where you want to apply.


 3rd and last you have to select table collection table


are there are transactions into Retail Credit Voucher Table then, you have to update your existing dataareaid record via SQL :- Update RETAILCREDITVOUCHERTABLE Set DATAAREAID='CM'


Saturday 13 October 2018

Account number for transaction type Sales order issue does not exist Error while Posting Statement and Calculation

Error :- Account number for transaction type Sales order issue does not exist Error came when you are posting or calculation statement in retail



Reason : Item Group Missing into the item master.

Solution:- Update the item master with appropriate item group,for checking item group missing run below query into the HQ database.


select * from INVENTTABLE where itemid not in (
select ITEMID from InventItemGroupItem where ITEMDATAAREAID=1001 )
and DATAAREAID=1001

AX 2012 for Retail: “The number for one time customer is missing” and payment posts with earlier date than sales invoice when posting Retail Statements

AX 2012 for Retail: “The number for one time customer is missing”  when calculating and posting Retail Statements or at the time of POS billing

Solution :- Just update customer account table into HQ database and sync job if getting error into POS billing

Update RetailCustTable set NonChargableAccount ='0' where AccountNum ='Cus001'

Wednesday 26 September 2018

Error A reservation hierarchy must be set up for the item. You can create transactions for the item after a reservation hierarchy has been set up

Error:- If you are getting error "A reservation hierarchy must be set up for the item. You can create transactions for the item after a reservation hierarchy has been set up" at the time of Calculate/Posting Statement

Solution:- Run below procedure into HQ Database

USE [ProdDynamicsAX]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create Procedure [dbo].[ReservationHierarchyNotFound] (@frodate as datetime,@storeid as int) as
select itemid from  RETAILTRANSACTIONSALESTRANS where transdate=@frodate and store=@storeid and itemid in (select itemid from InventTable where itemid not in (select itemid from WHSRESERVATIONHIERARCHYITEM) )

Exec ReservationHierarchyNotFound  '2018-09-26','011'

Tuesday 25 September 2018

How to Change Retail Store Name HQ and Store

Scenario :-  If you want to change your Retail Channel Store Number which is already running with different  Number.

Steps:-  Go to the Retail - Common -Retail Channels--Retail Stores Right Click on Store Number Go to the Record Info Click on Rename , this process will take time to rename in all the transaction but in only HQ (AX).


Change Name in Store Database run below query into the SQL

AX-- In case sync data from store to HQ after Rename

delete from  RETAILTRANSACTIONTAXTRANSGTE where storeid='AFCOURT' and transactionid in
(select transactionid from RETAILTRANSACTIONSALESTRANS where store='AFCOURT' and transdate='2018/08/24')

delete from RETAILTRANSACTIONINFOCODETRANS where store='AFCOURT' and transdate='2018/08/24'
delete from RETAILTRANSACTIONPAYMENTTRANS where store='AFCOURT'  and transdate='2018/08/24'
delete from  RETAILTRANSACTIONSALESTRANS  where store ='AFCOURT' and transdate='2018/08/24'
delete from RETAILTRANSACTIONTABLE where store='AFCOURT' and transdate='2018/08/24'

POS 
update RETAILTRANSACTIONSALESTRANS set store='011' where store='AFCOURT' and transdate='2018/08/24'
update RETAILTRANSACTIONTABLE set store='011' where store='AFCOURT' and transdate='2018/08/24'
update RETAILTRANSACTIONINFOCODETRANS set store='011' where store='AFCOURT' and transdate='2018/08/24'

update RETAILTRANSACTIONTAXTRANSGTE set storeid='011' where transactionid in (
select transactionid from  RETAILTRANSACTIONTAXTRANSGTE   where  transactionid
in (select transactionid from RETAILTRANSACTIONSALESTRANS where store='011' and transdate='2018/08/24'))

or Create Procedure

USE [ProdDynamicsAX]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[RCT_RetailStoreNameChange] (@transdate as datetime) as

update [192.168.2.55].PRODFCT011.ax.RETAILTRANSACTIONSALESTRANS set store='011' where store='AFCOURT' and transdate= @transdate
update [192.168.2.55].PRODFCT011.ax.RETAILTRANSACTIONTABLE set store='011' where store='AFCOURT' and transdate= @transdate
update [192.168.2.55].PRODFCT011.ax.RETAILTRANSACTIONINFOCODETRANS set store='011' where store='AFCOURT' and transdate= @transdate

update [192.168.2.55].PRODFCT011.ax.RETAILTRANSACTIONTAXTRANSGTE set storeid='011' where transactionid in (
select transactionid from  [192.168.2.55].PRODFCT011.ax.RETAILTRANSACTIONTAXTRANSGTE   where  transactionid 
in (select transactionid from [192.168.2.55].PRODFCT011.ax.RETAILTRANSACTIONSALESTRANS where store='011' and transdate=@transdate))

delete from  RETAILTRANSACTIONTAXTRANSGTE where storeid='AFCOURT' and transactionid in 
 (select transactionid from RETAILTRANSACTIONSALESTRANS where store='AFCOURT' and transdate=@transdate)

delete from RETAILTRANSACTIONINFOCODETRANS where store='AFCOURT' and transdate=@transdate
delete from RETAILTRANSACTIONPAYMENTTRANS where store='AFCOURT'  and transdate=@transdate
delete from  RETAILTRANSACTIONSALESTRANS  where store ='AFCOURT' and transdate=@transdate
delete from RETAILTRANSACTIONTABLE where store='AFCOURT' and transdate= @transdate



Thursday 20 September 2018

Retail Statement Calculating/Posting Error " Unknown Or Incorrectly selected return lot."

Problem :- Retail Statement Calculating/Posting Error " Unknown or incorrectly Selected return lot "


Cause :- This problem comes due to partial statement posting or got disconnect while calculating statement.

Solution:- Remove ReturnTransactionId from RetailTransactionSalesTrans, After Calculating and Posting ,again you have to update that ReturnTransactionId into RetailTransactionSalesTrans with same record.

SQL Query :- Below query you have to run on your HQ database

1.  Select Returntransactionid,* From Retailtransactionsalestrans Where Itemid='1242A9991000018' And Dataareaid='1006' and STATEMENTID ='002-000376'

  1. Update Retailtransactionsalestrans Set Returntransactionid='' Where Itemid='1242A9991000018' And Dataareaid='1006' And Receiptid='00910420000017' and STATEMENTID ='002-000376'
  1. Update Retailtransactionsalestrans Set Returntransactionid='009-T-087-11926' Where Itemid='1242A9991000018' And Dataareaid='1006' And Receiptid='00910420000017' and STATEMENTID ='002-000376'

Friday 14 September 2018

The Quantity Being Returned is greater than what can be covered by the return lot

Problem :- Facing Error at the time of calculating Retail Statement "The Quantity Being Returned is greater than what can be covered by the return lot."


Solution :- Comment Image code then calculate the statement. 

How To Delete and Re Post Retail Statement

Problem :- Getting retail statement calculation error "Insufficient Inventory Transactions With Status On Order,Reserved Ordered Reserved Physical And Picked."


Cause :- this error comes due to partial calculation or partial posted statement.

Solution:- Run below procedure into the HQ database, then clear the statement and again calculate statement.

USE [ProdDynamicsAX]
GO
/****** Object:  StoredProcedure [dbo].[RCT_ReverseStatement]    Script Date: 09-10-2018 07:37:39 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create Procedure [dbo].[ReverseStatement] (@dataareaid  nvarchar(50),@stmtid nvarchar(50), @storeid nvarchar(50) )as

--declare @dataareaid  nvarchar(50)
--set @dataareaid='1001'
--declare @stmtid   nvarchar(50)
--set @stmtid='AFCOURT-000051'
--declare  @storeid   nvarchar(50) 
--set @storeid = '011'


update retailtransactiontable set SALESORDERID = '' where statementid = @stmtid and type = 2 and store = @storeid and recid in 
(select recid from retailtransactiontable where statementid = @stmtid and type = 2 and store = @storeid  )

update RETAILSTATEMENTTABLE set POSTINGDATE = '' where STATEMENTID = @stmtid and recid in 
(select recid from RETAILSTATEMENTTABLE  where STATEMENTID = @stmtid )

UPDATE RETAILTRANSACTIONTABLE SET STATEMENTID ='', ENTRYSTATUS = 0,SALESORDERID = '',INVOICEID = '' WHERE DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND ENTRYSTATUS not in (1,3) and recid in 
(select recid from RETAILTRANSACTIONTABLE where  DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND ENTRYSTATUS not in (1,3) )

UPDATE RETAILTRANSACTIONTABLE SET STATEMENTID ='', SALESORDERID = '',INVOICEID = '' 
WHERE DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND ENTRYSTATUS in (1,3) and recid in 
(select recid from RETAILTRANSACTIONTABLE where  DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND ENTRYSTATUS in (1,3) )


UPDATE RETAILTRANSACTIONSALESTRANS SET STATEMENTID ='', INVENTTRANSID = '', TRANSACTIONSTATUS = 0, INVENTSTATUSSALES = 0,COSTAMOUNT = 0, INVENTDIMID = '' 
WHERE DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3) and recid in 
(select recid from RETAILTRANSACTIONSALESTRANS where DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3) )

UPDATE RETAILTRANSACTIONSALESTRANS SET STATEMENTID ='', INVENTTRANSID = '', INVENTSTATUSSALES = 0, COSTAMOUNT = 0, INVENTDIMID = '' 
WHERE DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3) and recid in 
(select recid from RETAILTRANSACTIONSALESTRANS where DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3))


UPDATE RETAILTRANSACTIONPAYMENTTRANS SET STATEMENTID = '', TRANSACTIONSTATUS = 0,STATEMENTCODE  = ''
WHERE DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3) and recid in 
(select recid from RETAILTRANSACTIONPAYMENTTRANS where DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3))


UPDATE RETAILTRANSACTIONPAYMENTTRANS SET STATEMENTID = '', STATEMENTCODE  = '' WHERE DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3) and recid in 
(select recid from RETAILTRANSACTIONPAYMENTTRANS where DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3))


UPDATE RETAILTRANSACTIONBANKEDTENDERTRANS SET STATEMENTID = '',TRANSACTIONSTATUS = 0 
WHERE DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3) and recid in 
(select recid from RETAILTRANSACTIONBANKEDTENDERTRANS where DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid)
 AND TRANSACTIONSTATUS not in (1,3))


UPDATE RETAILTRANSACTIONBANKEDTENDERTRANS SET STATEMENTID = '' WHERE DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3) and recid in 
(select recid from RETAILTRANSACTIONBANKEDTENDERTRANS where  DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3))


UPDATE RETAILTRANSACTIONSAFETENDERTRANS SET STATEMENTID = '', TRANSACTIONSTATUS = 0 
WHERE DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3) and recid in 
(select recid from RETAILTRANSACTIONSAFETENDERTRANS where DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid)
 AND TRANSACTIONSTATUS not in (1,3))

UPDATE RETAILTRANSACTIONSAFETENDERTRANS SET STATEMENTID = '' WHERE DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) 
AND TRANSACTIONSTATUS in (1,3)
and recid in (select recid from  RETAILTRANSACTIONSAFETENDERTRANS where  DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid)
AND TRANSACTIONSTATUS in (1,3))

UPDATE RETAILTRANSACTIONINCOMEEXPENSETRANS SET STATEMENTID = '', TRANSACTIONSTATUS = 0 
WHERE DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3) and recid in 
(select recid from RETAILTRANSACTIONINCOMEEXPENSETRANS where DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) 
AND TRANSACTIONSTATUS not in (1,3) )


UPDATE RETAILTRANSACTIONINCOMEEXPENSETRANS SET STATEMENTID = '' WHERE DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3) and recid in 
(select recid from RETAILTRANSACTIONINCOMEEXPENSETRANS WHERE DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3) )

UPDATE RETAILTRANSACTIONORDERINVOICETRANS SET STATEMENTID = '', TRANSACTIONSTATUS = 0 WHERE DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3) and recid in 
(select recid from RETAILTRANSACTIONORDERINVOICETRANS where  DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3) )

UPDATE RETAILTRANSACTIONORDERINVOICETRANS SET STATEMENTID = '' WHERE DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3) and recid in 
(select recid from RETAILTRANSACTIONORDERINVOICETRANS WHERE DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3) )

UPDATE RETAILTRANSACTIONINFOCODETRANS SET STATEMENTID = '', TRANSACTIONSTATUS = 0 WHERE DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3) and recid in 
(select recid from RETAILTRANSACTIONINFOCODETRANS where DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3) )

UPDATE RETAILTRANSACTIONINFOCODETRANS SET STATEMENTID = '' WHERE DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3) and recid in 
(select recid from RETAILTRANSACTIONINFOCODETRANS where DATAAREAID = @dataareaid 
AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3) )

UPDATE RETAILTRANSACTIONTENDERDECLARATIONTRANS SET STATEMENTID = '', TRANSACTIONSTATUS = 0, 
StatementCode = '' WHERE DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS not in (1,3) and recid in
(select recid from RETAILTRANSACTIONTENDERDECLARATIONTRANS where  DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid)
 AND TRANSACTIONSTATUS not in (1,3))

UPDATE RETAILTRANSACTIONTENDERDECLARATIONTRANS SET STATEMENTID = '', StatementCode = '' WHERE
 DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3) and recid in 
 (select recid from RETAILTRANSACTIONTENDERDECLARATIONTRANS where  DATAAREAID = @dataareaid AND 
 STATEMENTID in (@stmtid) AND TRANSACTIONSTATUS in (1,3))

DELETE RETAILSTATEMENTJOUR WHERE DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) and recid in 
(select recid from RETAILSTATEMENTJOUR where DATAAREAID = @dataareaid AND STATEMENTID in (@stmtid) )

DELETE RETAILSTATEMENTTRANS WHERE DATAAREAID = @dataareaid AND  STATEMENTID in (@stmtid) and recid in
(select recid from RETAILSTATEMENTTRANS where  DATAAREAID = @dataareaid AND  STATEMENTID in (@stmtid))

Delete RETAILSTATEMENTVOUCHER where STATEMENTID in (@stmtid) and recid in 
(select recid from RETAILSTATEMENTVOUCHER  where STATEMENTID in (@stmtid))

Exec Reversestatement '1001','afcourt-000037','011'



Wednesday 22 August 2018

Temp Cleaner with desktop backup Batch Jobs

Temp Cleaner with desktop backup
-----------------------------------------------Mr. Cleaner--------------------------------------
cls
@echo off
:: BatchGotAdmin
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    exit /B
:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"

netsh interface set interface name="Ethernet" admin=DISABLE
netsh interface set interface name="Ethernet 2" admin=DISABLE
netsh interface set interface name="Ethernet 3" admin=DISABLE
netsh interface set interface name="Ethernet 4" admin=DISABLE
netsh interface set interface name="Ethernet 5" admin=DISABLE
netsh interface set interface name="Ethernet 6" admin=DISABLE
netsh interface set interface name="Ethernet 7" admin=DISABLE
netsh interface set interface name="Ethernet 8" admin=DISABLE
netsh interface set interface name="Ethernet 9" admin=DISABLE
netsh interface set interface name="Ethernet 10" admin=DISABLE
netsh interface set interface name="Ethernet 11" admin=DISABLE
netsh interface set interface name="Ethernet 12" admin=DISABLE
netsh interface set interface name="Ethernet 13" admin=DISABLE
netsh interface set interface name="Ethernet 14" admin=DISABLE
netsh interface set interface name="Ethernet 15" admin=DISABLE
netsh interface set interface name="Ethernet 16" admin=DISABLE
netsh interface set interface name="Ethernet 17" admin=DISABLE
netsh interface set interface name="Ethernet 18" admin=DISABLE
netsh interface set interface name="Ethernet 19" admin=DISABLE
netsh interface set interface name="Ethernet 20" admin=DISABLE
netsh interface set interface name="Ethernet 21" admin=DISABLE
netsh interface set interface name="Wi-Fi" admin=DISABLE
netsh interface set interface name="Wi-Fi 2" admin=DISABLE
netsh interface set interface name="Wi-Fi 3" admin=DISABLE
netsh interface set interface name="Wi-Fi 4" admin=DISABLE
netsh interface set interface name="Wi-Fi 5" admin=DISABLE
netsh interface set interface name="Wi-Fi 6" admin=DISABLE
netsh interface set interface name="Wi-Fi 7" admin=DISABLE
netsh interface set interface name="Wi-Fi 8" admin=DISABLE
netsh interface set interface name="Wi-Fi 9" admin=DISABLE
netsh interface set interface name="Wi-Fi 10" admin=DISABLE
netsh interface set interface name="Wi-Fi 11" admin=DISABLE
netsh interface set interface name="Wi-Fi 12" admin=DISABLE
netsh interface set interface name="Wi-Fi 13" admin=DISABLE
netsh interface set interface name="Wi-Fi 14" admin=DISABLE
netsh interface set interface name="Wi-Fi 15" admin=DISABLE
netsh interface set interface name="Wi-Fi 16" admin=DISABLE
netsh interface set interface name="Wi-Fi 17" admin=DISABLE
netsh interface set interface name="Wi-Fi 18" admin=DISABLE
netsh interface set interface name="Wi-Fi 19" admin=DISABLE
netsh interface set interface name="Wi-Fi 20" admin=DISABLE
netsh interface set interface name="Wi-Fi 21" admin=DISABLE
ipconfig/flushDNS
taskkill.exe /f /fi "status eq not responding"
w32tm /query /peers
sc config w32time start= auto
w32tm /config /syncfromflags:manual /manualpeerlist:"0.us.pool.ntp.org,1.us.pool.ntp.org,2.us.pool.ntp.org,3.us.pool.ntp.org"
w32tm /config /reliable:yes
net stop w32time
net start w32time
w32tm /resync /nowait
net stop spooler
cls
Del /S "%LOCALAPPDATA%\*.auc " /q
Del /s "%LOCALAPPDATA%\temp\*.*" /q
Del /s /q %systemdrive%\$Recycle.bin
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\*
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations\*
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\CustomDestinations\*
REG ADD "HKCU\SOFTWARE\Microsoft\Windows\Shell\Bags\1\Desktop" /V FFLAGS /T REG_DWORD /D 1075839521 /F
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351
set ChromeDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data
del /q /s /f "%ChromeDir%"
rd /s /q "%ChromeDir%"
set DataDir=C:\Users\%USERNAME%\AppData\Local\Mozilla\Firefox\Profiles
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
for /d %%x in (C:\Users\%USERNAME%\AppData\Roaming\Mozilla\Firefox\Profiles\*) do del /q /s /f %%x\*sqlite
set DataDir=C:\Users\%USERNAME%\AppData\Local\Opera\Opera
set DataDir2=C:\Users\%USERNAME%\AppData\Roaming\Opera\Opera
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
del /q /s /f "%DataDir2%"
rd /s /q "%DataDir2%"
set DataDir=C:\Users\%USERNAME%\AppData\Local\Microsoft\Intern~1
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
set History=C:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\History
del /q /s /f "%History%"
rd /s /q "%History%"
set IETemp=C:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\Tempor~1
del /q /s /f "%IETemp%"
rd /s /q "%IETemp%"
set Cookies=C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Cookies
del /q /s /f "%Cookies%"
rd /s /q "%Cookies%"
C:\bin\regdelete.exe HKEY_CURRENT_USER "Software\Microsoft\Internet Explorer\TypedURLs"
set FlashCookies=C:\Users\%USERNAME%\AppData\Roaming\Macromedia\Flashp~1
del /q /s /f "%FlashCookies%"
rd /s /q "%FlashCookies%"
set curr_date=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%
mkdir "%USERPROFILE%\My Documents\Backup\%curr_date%_backup"
xcopy "%USERPROFILE%\Desktop" "%USERPROFILE%\My Documents\Backup\%curr_date%_backup" /D/S/H/V/C/F/K/Y
for /d /r "%USERPROFILE%\Desktop" %%x in (*) do rd /s /q "%%x"
for /r "%USERPROFILE%\Desktop" %%x in (*) do del /f "%%x"
copy "%USERPROFILE%\My Documents\Backup\%curr_date%_backup\*.lnk" "%USERPROFILE%\Desktop\"
del /q "%USERPROFILE%\My Documents\Backup\%curr_date%_backup\*.lnk"
rd /q /s c:\$Recycle.Bin
rd /q /s d:\$Recycle.Bin
rd /q /s e:\$Recycle.Bin
rd /q /s f:\$Recycle.Bin
rd /q /s g:\$Recycle.Bin
rd /q /s h:\$Recycle.Bin
REG ADD "HKCU\SOFTWARE\Microsoft\Windows\Shell\Bags\1\Desktop" /V FFLAGS /T REG_DWORD /D 1075839521 /F
taskkill /f /im explorer.exe
start explorer.exe
mrt.exe
netsh interface set interface name="Ethernet" admin=ENABLE
netsh interface set interface name="Ethernet 2" admin=ENABLE
netsh interface set interface name="Ethernet 3" admin=ENABLE
netsh interface set interface name="Ethernet 4" admin=ENABLE
netsh interface set interface name="Ethernet 5" admin=ENABLE
netsh interface set interface name="Ethernet 6" admin=ENABLE
netsh interface set interface name="Ethernet 7" admin=ENABLE
netsh interface set interface name="Ethernet 8" admin=ENABLE
netsh interface set interface name="Ethernet 9" admin=ENABLE
netsh interface set interface name="Ethernet 10" admin=ENABLE
netsh interface set interface name="Ethernet 11" admin=ENABLE
netsh interface set interface name="Ethernet 12" admin=ENABLE
netsh interface set interface name="Ethernet 13" admin=ENABLE
netsh interface set interface name="Ethernet 14" admin=ENABLE
netsh interface set interface name="Ethernet 15" admin=ENABLE
netsh interface set interface name="Ethernet 16" admin=ENABLE
netsh interface set interface name="Ethernet 17" admin=ENABLE
netsh interface set interface name="Ethernet 18" admin=ENABLE
netsh interface set interface name="Ethernet 19" admin=ENABLE
netsh interface set interface name="Ethernet 20" admin=ENABLE
netsh interface set interface name="Ethernet 21" admin=ENABLE
netsh interface set interface name="Wi-Fi" admin=ENABLE
netsh interface set interface name="Wi-Fi 2" admin=ENABLE
netsh interface set interface name="Wi-Fi 3" admin=ENABLE
netsh interface set interface name="Wi-Fi 4" admin=ENABLE
netsh interface set interface name="Wi-Fi 5" admin=ENABLE
netsh interface set interface name="Wi-Fi 6" admin=ENABLE
netsh interface set interface name="Wi-Fi 7" admin=ENABLE
netsh interface set interface name="Wi-Fi 8" admin=ENABLE
netsh interface set interface name="Wi-Fi 9" admin=ENABLE
netsh interface set interface name="Wi-Fi 10" admin=ENABLE
netsh interface set interface name="Wi-Fi 11" admin=ENABLE
netsh interface set interface name="Wi-Fi 12" admin=ENABLE
netsh interface set interface name="Wi-Fi 13" admin=ENABLE
netsh interface set interface name="Wi-Fi 14" admin=ENABLE
netsh interface set interface name="Wi-Fi 15" admin=ENABLE
netsh interface set interface name="Wi-Fi 16" admin=ENABLE
netsh interface set interface name="Wi-Fi 17" admin=ENABLE
netsh interface set interface name="Wi-Fi 18" admin=ENABLE
netsh interface set interface name="Wi-Fi 19" admin=ENABLE
netsh interface set interface name="Wi-Fi 20" admin=ENABLE
netsh interface set interface name="Wi-Fi 21" admin=ENABLE
cls
net start spooler
Cleanmgr
cls
defrag D:
defrag C:
sfc /scannow
Fsutil behavior query memoryusage
Fsutil behavior set memoryusage 2
shutdown -r
exit

-------------------------------------------------XXXX--------------------------------------------------

How to create batch job to register self signed certificate in local machine, below query save into your batch file as per your path.

------------------------------------Register Certificate-------------------------------------------------
cd\
cls
@echo off
:: BatchGotAdmin
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    exit /B
:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
md C:\Prod_Certificate
cd Windows\system32
Robocopy \\192.168.2.52\POS_Installation_Setup\Certificate\ C:\Prod_Certificate\
certutil -p a -importpfx root C:\Prod_Certificate\Prod_Certificate.pfx
---------------------------------------------xxxxxxxxxxxxxxxxxxxxx--------------------------------------

How to create batch job to stop and restart services of local machine, below query save into your batch file as per your path
-----------------------------------------------Mange Services------------------------------------------------
cd\
cls
@echo off
:: BatchGotAdmin
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    exit /B
:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
cd Windows\system32
net stop "CommerceDataExchangeAsyncClientService"
net stop "CommerceDataExchangeAsyncClientService_SPM001"
net stop "CommerceDataExchangeAsyncClientService_FST002"
net stop "CommerceDataExchangeAsyncClientService_RS1003"
net stop "CommerceDataExchangeAsyncClientService_RS7004"
net stop "CommerceDataExchangeAsyncClientService_SRT005"
net stop "CommerceDataExchangeAsyncClientService_SRG006"
net stop "CommerceDataExchangeAsyncClientService_SRE007"
net stop "CommerceDataExchangeAsyncClientService_SMC008"
net stop "CommerceDataExchangeAsyncClientService_RCT009"
net stop "CommerceDataExchangeAsyncClientService_JYT010"
net stop "Microsoft.Dynamics.AX.Framework.Tools.DMF.SSISHelperService.exe"
net stop "Microsoft Dynamics AX Commerce Data Exchange: Real-time Service 5.1"
net stop "Microsoft Dynamics AX Commerce Data Exchange: Real-time Service 6.1"
net stop "CommerceDataExchangeAsyncClientService"
net stop "CommerceDataExchangeAsyncClientService_RCTS1"
net stop "CommerceDataExchangeAsyncClientService_RCTS7"
net stop "AOS60$02"
net stop "MSSQLSERVER"
net start "MSSQLSERVER"
net stop "SSASTELEMETRY"
net stop "MSSQLServerOLAPService"
net stop "ReportServer"
net start "AOS60$02"
net start "CommerceDataExchangeAsyncClientService"
net start "CommerceDataExchangeAsyncClientService_SPM001"
net start "CommerceDataExchangeAsyncClientService_RCTS1"
net start "CommerceDataExchangeAsyncClientService_RCTS7"
net start "CommerceDataExchangeAsyncClientService_FST002"
net start "CommerceDataExchangeAsyncClientService_RS1003"
net start "CommerceDataExchangeAsyncClientService_RS7004"
net start "CommerceDataExchangeAsyncClientService_SRT005"
net start "CommerceDataExchangeAsyncClientService_SRG006"
net start "CommerceDataExchangeAsyncClientService_SRE007"
net start "CommerceDataExchangeAsyncClientService_SMC008"
net start "CommerceDataExchangeAsyncClientService_RCT009"
net start "CommerceDataExchangeAsyncClientService_JYT010"
net start "Microsoft.Dynamics.AX.Framework.Tools.DMF.SSISHelperService.exe"
net start "Microsoft Dynamics AX Commerce Data Exchange: Real-time Service 5.1"
net start "Microsoft Dynamics AX Commerce Data Exchange: Real-time Service 6.1"
cls
exit
----------------------------------------xxxxxxxxxxxxxx-----------------------------------------------
How to create batch job to remove temp files from your local machine, below query save into your batch file as per your path


----------------------------------------------Temp Cleaner---------------------------------------------
cls
@echo off
:: BatchGotAdmin

REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"

ipconfig/flushDNS
cls
Del /S "%LOCALAPPDATA%\*.auc " /q
Del /s "%LOCALAPPDATA%\temp\*.*" /q
Del /s /q %systemdrive%\$Recycle.bin
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\*
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations\*
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\CustomDestinations\*
REG ADD "HKCU\SOFTWARE\Microsoft\Windows\Shell\Bags\1\Desktop" /V FFLAGS /T REG_DWORD /D 1075839521 /F
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351
set ChromeDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data
del /q /s /f "%ChromeDir%"
rd /s /q "%ChromeDir%"
set DataDir=C:\Users\%USERNAME%\AppData\Local\Mozilla\Firefox\Profiles
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
for /d %%x in (C:\Users\%USERNAME%\AppData\Roaming\Mozilla\Firefox\Profiles\*) do del /q /s /f %%x\*sqlite
set DataDir=C:\Users\%USERNAME%\AppData\Local\Opera\Opera
set DataDir2=C:\Users\%USERNAME%\AppData\Roaming\Opera\Opera
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
del /q /s /f "%DataDir2%"
rd /s /q "%DataDir2%"
set DataDir=C:\Users\%USERNAME%\AppData\Local\Microsoft\Intern~1
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
set History=C:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\History
del /q /s /f "%History%"
rd /s /q "%History%"
set IETemp=C:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\Tempor~1
del /q /s /f "%IETemp%"
rd /s /q "%IETemp%"
set Cookies=C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Cookies
del /q /s /f "%Cookies%"
rd /s /q "%Cookies%"
C:\bin\regdelete.exe HKEY_CURRENT_USER "Software\Microsoft\Internet Explorer\TypedURLs"
set FlashCookies=C:\Users\%USERNAME%\AppData\Roaming\Macromedia\Flashp~1
del /q /s /f "%FlashCookies%"
rd /s /q "%FlashCookies%"
cd windows
cd system32
cls
exit
------------------------------------------------------------xxxxxxxxxxx--------------------------------------------