Found 975 Articles for Software & Coding

How to get the list of shared folders using PowerShell?

Chirag Nagrekar
Updated on 01-Mar-2021 10:49:21

8K+ Views

Get-SmbShare gives all the shared folders on the local system.PS C:\Temp> Get-SmbShare Name    ScopeName    Path       Description ----    ---------    ----       ----------- ADMIN$    *       C:\Windows    Remote Admin C$        *       C:\ Default    share DSC       *       E:\DSC E$        *       E:\           Default share IPC$      *                      Remote IPC Shared1   *       E:\ExtractExampleTo ... Read More

How to get the Shared folder permissions with PowerShell?

Chirag Nagrekar
Updated on 01-Mar-2021 10:47:51

22K+ Views

To get the shared folder permissions using PowerShell, we can use the Get-SmbShare cmdlet.For example, we have a shared folder name DSC and we need to retrieve its permissions, we can use the below command.CommandGet-SmbShare -Name DSCOutputName ScopeName Path Description ---- --------- ---- ----------- DSC       *   E:\DSCIt doesn’t show the permission by default and we can retrieve the full list using Fl *. For example, Get-SmbShare -Name DSC | fl *And you can see the PresentPathACL property there. This property is used to retrieve the permissions on the shared folder. So we can directly use the command, Command(Get-SmbShare -Name ... Read More

How to change SMB shared folder access permission using PowerShell?

Chirag Nagrekar
Updated on 01-Mar-2021 10:46:23

7K+ Views

We can use the command Grant-SmbShareAccess to change the shared folder access permission or to assign the new user to the shared folder with permission.In this example, we have already shared a folder name called “Shared Folder” and everyone's user permission is assigned with the read access and we will change it to the Full access permission.PS C:\Temp> Get-SmbShareAccess -Name "Shared folder" Name          ScopeName AccountName AccessControlType AccessRight ----          --------- ----------- ----------------- ----------- Shared folder    *       Everyone          Allow         ReadExampleTo change the permission ... Read More

How to remove windows folder sharing using PowerShell?

Chirag Nagrekar
Updated on 01-Mar-2021 10:09:16

3K+ Views

To remove the windows folder sharing using PowerShell, we can use the Remove-Smbshare command. For example, PS C:\Temp> Remove-SmbShare -Name DSC Confirm Are you sure you want to perform this action? Performing operation 'Remove-Share' on Target '*, DSC'. [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):Once you use this command, it will ask for confirmation. To remove the sharing forcefully, use - Force parameter. For example, Remove-SmbShare -Name DSC -ForceTo remove the shared folder permissions on the remote computer, you need to use the CIM session.In the below example, ... Read More

How to share a windows folder using PowerShell?

Chirag Nagrekar
Updated on 01-Mar-2021 10:45:13

12K+ Views

To share a windows folder using PowerShell, we can use the New-SmbShare command. This command is a part of the module SmbShare.In this example, we have a folder called “DSC” and we want to share. The below command will simply share folderNew-SmbShare -Path E:\DSC\ -Name "Shared Folder"OutputName          ScopeName Path Description ----          --------- ---- ----------- Shared Folder    *      E:\DSCDSC folder will be shared with a “Shared Folder” name with everyone’s Read Permission by default because we haven’t specified the scope yet.To assign the Full Access permission to the specific user, ... Read More

How to update the specific node of the XML file using PowerShell?

Chirag Nagrekar
Updated on 01-Mar-2021 12:09:27

7K+ Views

To update the specific XML node using PowerShell, we first need to select that node with the attribute with SelectSingleNode() method.We have below the XML file from the link stored in SampleXml.XML on C:\Temp location.https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms762271(v=vs.85)In this example, we are going to update Autor and Genre properties of the Book having attribute Id = ‘bk102’$xml=[xml](Get-Content C:\Temp\SampleXML.xml)$node=$xml.SelectSingleNode("//book[@id='bk102']")The above commands will load the XML file and select node with attribute value ‘bk102’.$node.genre='Non-Fiction' $node.author='Dell James' $xml.Save("C:\Temp\SampleXML.xml")The above commands will update the genre and author property.Read More

How to delete the specific node from the XML file using PowerShell?

Chirag Nagrekar
Updated on 01-Mar-2021 09:59:35

11K+ Views

To delete the specific XML node from the PowerShell, we can use the RemoveChild() method of the XML.For example, We have a sample XML file from Microsoft.https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms762271(v=vs.85)We have saved the above file into C:\Temp\SampleXml.XML and we need to delete the book node with attribute ‘bk102’ and for that, we will use the XPath method of the XML.Below commands will first search the XML book node with the book attribute ‘bk102’ and then we will delete it.$xml = [xml](Get-Content C:\Temp\SampleXML.xml) $node = $xml.SelectSingleNode("//book[@id='bk102']") $node.ParentNode.RemoveChild($node) | Out-Null $xml.Save('C:\Temp\SampleXML.xml')If you want to delete all the nodes which have the name “Book”, we can ... Read More

How to add an attribute to the XML file using Powershell?

Chirag Nagrekar
Updated on 01-Mar-2021 09:56:31

8K+ Views

To add the attribute to the XML, we first need to add the Element and then we will add an attribute for it.Below is a sample of the XML file.Example           Gambardella, Matthew       XML Developer's Guide       Computer       44.95       2000-10-01       An in-depth look at creating applications with XML.     The below command will add the new element but the file won’t be saved. We will save the file after the attribute is added.$file = "C:\Temp\SampleXML.xml" $xmlfile = [xml](Get-Content $file) $newbookelement ... Read More

Explain BLOB object and tree object in Git.

kannan sudhakaran
Updated on 20-Feb-2021 09:04:17

2K+ Views

Git uses a series of BLOBs and trees to store content of the working directory of a project. Whenever we perform a commit operation, Git internally creates a series of trees and BLOBs, which is the binary representation of the project folder structure at that point in time of commit.What is BLOB?BLOB stands for Binary Large Object. Each version of a file in Git is represented as a BLOB. A BLOB holds a file’s data but doesn’t contain any metadata about the file or even its name.To understand a BLOB let us see an example.Create 3 files “file1.txt”, “file2.txt” and ... Read More

What is the short status in Git?

kannan sudhakaran
Updated on 20-Feb-2021 09:01:52

2K+ Views

The git status command returns the current state of the −Working areaStaging areaThis command returns tracked and untracked files and changes made to the repository. However, this command does not show any commit records or information. This command usually returns a status message denoting one of the following states −No commit historyUntracked filesChanges pending to be committedClean working treeModified filesDeleted filesThe syntax for using the git status command is given below −$ git statusA screenshot of the above command’s output is below. The output indicates that the file has been modified.dell@DESKTOP-N961NR5 MINGW64 /e/tut_repo (master) $ git status On branch master ... Read More

Advertisements