Giter VIP home page Giter VIP logo

powershellscripts's Introduction

  • For DeleteTFS*

๐Ÿ“œVisual Studio File Remover PowerShell Script*

This is an Explanation for the PowerShell Script that removes the files from TFs

  • Parameters - Solution The path to the .sln file (Mandatory)
  • Parameters - FilePath The path to the file containing the names of files to deleted. (Mandatory)
  • Parameters - TfPath Path for TF.exe file. It can be different in different machines check if this path is right before execution. (Not Mandatory)
  • Parameters - DeleteFromTfs Mark files as pending deletion in TFS (Not Mandatory)
  • Parameters - DeleteFromDisk Delete the files directly from the disk ( Not Mandatory)

This script has two mandatory parameters (mentioned above). First is the path of the solution and second is the path of the text file containing the name of the files to be deleted. if DeleteFromTfs is provided as a parameter it will mark those file as pending deletion in the TFS otherwise it will only show the full path of the files. If DeleteFromDisk is provided as parameter it will delete the file from the location where they are located. Remember to check the path of the TF.exe (TfPath). It can be different for different machines. The default has been set to "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe"

Example .\VisualStudioFileRemoval.ps1 "C:\bureau\Bureau\CeridianTax\Dev\DevNG+1\Ceridian.NextGenACADB\Ceridian.NextGenACADB.sln" "C:\bureau\test.txt" -DeleteFromTfs

In the example above

  • โ€œ.\VisualStudioFileRemoval.ps1โ€œ is the name of the script
  • โ€œ"C:\bureau\Bureau\CeridianTax\Dev\DevNG+1\Ceridian.NextGenACADB\Ceridian.NextGenACADB.sln"โ€œ is the path of the solution file from which we need to remove files
  • โ€œ"C:\bureau\test.txt"โ€œ is the path of the text file containing the name of files to be deleted
  • โ€œ-DeleteFromTfsโ€œ is the parameter if provided will mark the file as pending deletion in tfs.

Related Articles/References Some of the articles or posts that I referenced for making this PowerShell Script https://stackoverflow.com/questions/8800977/remove-unused-cs-files-in-solution https://gist.github.com/mikesigs/3512dbccc1767d447977#file-deleteexcludedfiles-ps1 https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/?view=powershell-7.3 https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/use-team-foundation-version-control-commands?view=azure-devops

Share

๐Ÿ“œ Reference Finding Script

Created by Ankit Mehra Last updated: yesterday at 1:42 PM2 min read 2 people viewed This is an Explanation for the PowerShell Script that removes the files from TFs

Parameters - ProceduresFile The path to the file containing the Stored Procedure (Mandatory)

Parameters - ReferencesDir The Path of the Directory containing files that have references to stored procedure (Output directory of String Search Tool) (Mandatory)

Parameters - ProjectsFile Path of the Project file containing the name of project files that we are checking (Not Mandatory)

Parameters - OutputPath File path were you want to store the Used.txt and NotUsed.txt files. Default is same the directory from where script is run. (Not Mandatory)

๐Ÿ“ค Output

Two files used.txt and NotUsed.txt containing the names of the stored procedures used and not used respectively.

๐Ÿ’ก Example

& ./CheckReferences.ps1 "C:\Users\P12A2B3\OneDrive - Ceridian HCM Inc\Desktop\TAXPORTAL_SP\Sps.txt" "C:\Users\P12A2B3\OneDrive - Ceridian HCM Inc\Desktop\SearchResults" "C:\Users\P12A2B3\OneDrive - Ceridian HCM Inc\Desktop\TAXPORTAL_SP\projects.txt" "C:\Users\P12A2B3\OneDrive - Ceridian HCM Inc\Desktop\TAXPORTAL_SP\AllSpsTest" In the example above

โ€œ& ./CheckReferences.ps1 call operator and the name of the PowerShell script

"C:\Users\P12A2B3\OneDrive - Ceridian HCM Inc\Desktop\TAXPORTAL_SP\Sps.txt" is the path of the text files containing the names of the files stored procedure that we want to find references for.

"C:\Users\P12A2B3\OneDrive - Ceridian HCM Inc\Desktop\SearchResults" is the path of the directory that was the output directory of StringSearch Tool i.e. directory containing the files that have references for stored procedure

"C:\Users\P12A2B3\OneDrive - Ceridian HCM Inc\Desktop\TAXPORTAL_SP\projects.txt" is the path of files containing the names of projects that we want to search for references

"C:\Users\P12A2B3\OneDrive - Ceridian HCM Inc\Desktop\TAXPORTAL_SP\AllSpsTest" is an optional argument if given will store the used and notused files in the given path else it will just store in the directory where the script was ran from.

๐Ÿ“‹ Related Articles/References Some of the articles or posts that I referenced for making this PowerShell Script

Regular Expression for inline Comments Powershell

Finding Comments in Source Code Using Regular Expressions - Stephen Ostermiller

๐Ÿ“œVisual Studio Undeleting PowerShell Script

This is an Explanation for the PowerShell Script that undelete the files from TFs

Parameters - FilePath The path to the file containing the names of files to be Undeleted. (Mandatory)

Parameters - TfPath Path for TF.exe file. It can be different in different machines check if this path is right before execution. (Not Mandatory)

Parameters - UnDeleteFromTfs Mark files as pending deletion in TFS (Not Mandatory)

This script has one mandatory parameters (mentioned above). The path of the solution.

if UnDeleteFromTfs is provided as a parameter it will mark those file as pending undeleted in the TFS otherwise it will only show the path of the files.

Remember to check the path of the TF.exe (TfPath). It can be different for different machines. The default has been set to โ€œ"C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe"โ€œ

Provide the full path of the file that you want to delete in the text file for first parameter

:light_bulb_on: Example

& ./UnDeleteFiles.ps1 "C:\bureau\test.txt" -UnDeleteFromTfs In the example above

& ./UnDeleteFiles.ps1 is the call operator and the name of the script

"C:\bureau\test.txt" is the path of the text file containing the name of files to be Undeleted

-UnDeleteFromTfs is the parameter if provided will mark the file as pending Undeleted in tfs.

You can see that file has been marked undelete in pending changes tab of TFS. After the files has been marked as undelete and moved to pending changes folder they still need to be included in the project.

Go to Solution explore click on show all files

(you might have to close of Vs studio if your changes are not reflecting in solution explorer) and then right-click the file that you undeleted and click include in project.

powershellscripts's People

Contributors

ankit-mehra avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.