- 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 2043 Articles for Microsoft Technologies
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
14K+ Views
Traceroute is the way to determine the hopes that the packets are passing through when requested. In the command prompt, that utility is called the tracert and we can also use that utility to trace the network packets. For example, PS C:\> tracert google.com Tracing route to google.com [216.58.203.142] over a maximum of 30 hops: 1 1 ms 1 ms 1 ms 192.168.0.1 2 2 ms 2 ms 2 ms 45.114.51.246 3 8 ms 4 ms 4 ms 103.210.200.141 4 21 ms * * 10.10.125.29 5 ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
5K+ Views
To format a string in a PowerShell we can use various methods. First using the simple expanding string method.PS C:\> $str = 'PowerShell' PS C:\> Write-Output "Hello $str !!!!" Hello PowerShell !!!!Second, using the format method. In this method, we will use the Format function of the String .NET class.PS C:\> $str = "PowerShell" PS C:\> [String]::Format("Hello $str...!!!") Hello PowerShell...!!!The third method using the Format operator. We can use the number format here as shown below.PS C:\> $str = 'PowerShell' PS C:\> "Hello {0}" -f $str Hello PowerShellIf we have multiple variables then we need to increase the numbers inside ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
9K+ Views
Website status code is meant to be the status of the website as if the website request from the client is successful or not if the website is available or any error on the webpage which is causing the handshake failed with the client.There are various website status codes. Please refer to the below link for them.https://en.wikipedia.org/wiki/List_of_HTTP_status_codesTo retrieve the status using PowerShell, we will first connect the webpage using the Invoke-WebRequest command and then we can use the property StatusCode. For example, $req = Invoke-WebRequest -uri "https://theautomationcode.com" $reqOutputStatusCode : 200 StatusDescription : OK Content : ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
3K+ Views
To download the images from the webpage using the Invoke-WebRequest command, we can use the images property from the result to retrieve the images URL, and later we can use the method to download them at the specific location. Consider we have the URI: https://theautomationcode.com to retrieve the images.Once you run the below command, you can see the Images property there.Invoke-WebRequest -Uri "https://theautomationcode.com/feed/"To retrieves the images URL, $req = Invoke-WebRequest -Uri "https://theautomationcode.com/feed/" $req.Images | Select -ExpandProperty srcOutputhttps://i1.wp.com/theautomationcode.com/wp-content/uploads/2020/11/image-9.png?resize=178%2C60&ssl=1 https://i0.wp.com/theautomationcode.com/wp-content/uploads/2020/11/image-10.png?resize=640%2C68&ssl=1All the above URLs point to the images, so we can download that.$wc = New-Object System.Net.WebClient $req = Invoke-WebRequest -Uri "https://theautomationcode.com/feed/" $images = ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
523 Views
Splatting is the method to pass the collection of parameters as a single unit so it will be easier for the command to read. Array splatting uses the splat values which do not require parameter names. The values must be in positional number order in the array.We have a below copy example, in which we are copying one file from the source to the destination. Now we are not specifying the parameters here because we will use the positional parameter for the source path and the destination path.If we check the help for those parameters, we will come to know ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
663 Views
Splatting is the way to pass the collection of the parameters to the command as a single value. It uses the Hashtable splatting means that we can pass the Name and Value pair combination. We can use the named positional parameter for this with the values we want to provide.For example, First, we will check how we run the Copy-Item command here without splatting, $params = @{ Path = 'C:\Temp\25Aug2020.txt' Destination = 'C:\test1' Verbose = $true Force = $true } Copy-Item @paramsAnother Example, $hash = @{ From = 'harris@Microsoftmail.com' To = 'Jacob@MicrosoftMail.com' SMTP ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
268 Views
PowerShell splatting is a method to pass the collection of the parameters as a single command unit which makes the command shorter and easier for the user to read commands. Splatting uses the symbol (@) instead of ($) which tells the user that splatting is used and PowerShell is passing a set of values instead of a single value.Splatting in PowerShell was included from the v3.0 onwards and you can pass all parameters in the command.For example, $params = @{ Path = 'C:\Temp\25Aug2020.txt' Destination = 'C:\test1' Verbose = $true Force = $true } Copy-Item @paramsThe splatting ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
29K+ Views
To change the azure subscription using PowerShell, we can use the Select-AZSubscription command. When you use this command, you can use either the subscription ID, Subscription Name, or the Tenant ID.ExampleWith Subscription Name,Select-AzSubscription -SubscriptionName 'Visual Studio'With TenantID,Select-AzSubscription -Tenant 'XXXX-XXXXX-XXXXXXX-XXXX'With Subscription ID,Select-AzSubscription -SubscriptionId 'XXXX-XXXXX-XXXXXXX-XXXX'Sometimes on console messages will appear that one or more subscriptions are active. In that case, you can switch the other subscription using the Set-AZContext command and you can use subscription ID or the Name for it.ExampleSet-AzContext -SubscriptionId "xxxx-xxxx-xxxx-xxxx" OrSet-AzContext -SubscriptionName "Visual Studio"
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
3K+ Views
To use the PSCustomObject inside the Foreach Parallel loop, we first need to consider how we are using the variables inside the loop.$Out = "PowerShell" ForEach-Object -Parallel{ Write-Output "Hello.... $($using:Out)" }So let see if we can store or change a value in the $out variable.Example$Out = @() ForEach-Object -Parallel{ $using:out = "Azure" Write-Output "Hello....$($using:out) " }OutputLine | 4 | $using:out = "Azure" | ~~~~~~~~~~ | The assignment expression is not valid. The input to an assignment operator must be an object that is able to accept | assignments, such as a ... Read More
![Chirag Nagrekar](https://www.tutorialspoint.com/assets/profiles/163503/profile/60_109370-1581658197.png)
7K+ Views
When we simply write the Invoke-Command, it shows the output on the console.ExampleInvoke-Command -ComputerName Test1-Win2k12 -ScriptBlock {Get-Service}OutputIt shows the output along with the computer name.Now let's say you want to sort the output or you want to work with the output you need to store it. It is similar like we store the output in the variable but we can’t store the output inside the scriptblock and display it outside.$ser = @() Invoke-Command -ComputerName Test1-Win2k12 -ScriptBlock {$ser = Get-Service} Write-Output "Services output" $serYou won’t get any output of the above command because Invoke-Command is known to work on the remote computer. ... Read More