How do I concatenate strings and variables in PowerShell?
Suppose I have the following snippet:
$assoc = New-Object PSObject -Property @{
Id = 42
Name = "Slim Shady"
Owner = "Eminem"
}
Write-Host $assoc.Id + " - &qu...
This cmdlet is only available on the Windows platform. The New-Service cmdlet creates a new entry for a Windows service in the registry and in the service database. A new service requires an executable file that runs during the service. The parameters of this cmdlet let you set the display name, description, startup type, and dependencies of the service.
How do I pass multiple parameters into a function in PowerShell?
If I have a function which accepts more than one string parameter, the first parameter seems to get all the data assigned to it, and remaining parameters are passed in as empty.
A quick test scrip...
I have line of scripts for review here, I noticed variable declaration with a value:
function readConfig {
Param([string]$fileName)
$config = @{}
Get-Content $fileName | Where-Object {...
What does this syntax do: | select @{E={$_.PSComputerName}; L='Server'}, Name, ProcessId, PathName?
I have a Powershell script where there's a line:
$MyServers | select @{E={$_.PSComputerName}; L='AX Server'}, Name, ProcessId, PathName
What is the significance/function of this part? What does...
The following powershell script outputs a server diskspace report.
Is there a way of sorting the 'Percent' data in either desc or asc order?
[Script]
$computers | ForEach {
$Disks = Get-WMIObject
If I try to save a file in ISE, the default extension is Powershell Files with parenthesis (*.ps1, *.psm1, *.psd1, *.ps1xml, *.pssc, *.psrc, *.cdxml) and with descriptions
Powershell Scripts (*.ps1)
Given a string, where each path is quoted inside a double quotes, how do I split it into an array with each item is the literal substrings inside the double quotes. For example:
$input=read-host "...