- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 989 Articles for Software & Coding
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
8K+ Views
To copy only updated or newer files with PowerShell, we can use Copy-Item with some logic in the script that to check if the files exist on the destination folder if not then copy that file and if yes then compare the timestamp and copy the latest file. This would be tricky because we need to write several lines of code for it.But Windows support xCopy utility which can directly copy the newer or updated files and this utility we can accommodate in PowerShell as well.xCopy uses a switch called /d. its actual syntax is, Syntax/d [:MM-DD-YYYY]This means if the date ... Read More
![Kiran Kumar Panigrahi](https://www.tutorialspoint.com/assets/profiles/390736/profile/60_2598-1635242143.png)
28K+ Views
Algorithm and Pseudocode are the two related terms in computer programming. The basic difference between algorithm and pseudocode is that an algorithm is a step-by-step procedure developed to solve a problem, while a pseudocode is a technique of developing an algorithm. In this article, we will discuss the other important differences between an algorithm and a pseudocode. Let's start with some basic concepts of algorithm and pseudocode. What is an Algorithm? A sequence of steps to solve a given problem is called as algorithm. Thus, an algorithm is a step-by-step procedure developed for solving a given problem. An ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
7K+ Views
To check if the VMs are running, deallocated, or stopped using PowerShell, we need to use the - Status parameter.If you write only the Get-AzVM command to get the VM details, it won’t show up the Azure VM power status default.ExampleTo check the Azure VM Power Status, Get-AzVM -statusOutput The above command will show the Power State for all VMs for that particular subscription. For different subscriptions, you need to change the subscription and run this command.To get the VM Power State for the specific ResourceGroup, use the ResourceGroup name parameter.ExampleFor example, Get-AzVM -ResourceGroupName TestVMRG -StatusThe above command will retrieve all ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
6K+ 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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
19K+ 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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
6K+ 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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
2K+ 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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
10K+ 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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
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
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
8K+ 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