Example 3: Invoke a script and pass in variable values from a stringPowerShell Копіювати $StringArray = "MYVAR1='String1'", "MYVAR2='String2'" Invoke-Sqlcmd -Query "SELECT `$(MYVAR1) AS Var1, `$(MYVAR2) AS Var2" -Variable $StringArray Var1 Var2 --- --- ...
Default value:Current user Required:False Accept pipeline input:False Accept wildcard characters:False -FilterHashtable Specifies a query in hash table format to select events from one or more event logs. The query contains a hash table with one or morekey/valuepairs. ...
Append static csv column to result set on export of data; Using Select-Object and Export-CSV append string to all strings in array Appending info to the telephone (notes) tab in AD Appending line to info attribute with Powershell Appending Parent Folder, Current Folder onto file name Appending...
Now that’s not completely perfect, as it would have a hard coded DC name. And just our luck, it will be migrated out of existence and then our stuff breaks. So, let’s set a default parameter value with the result of a PowerShell query. In this case, a DC in the same site for...
Get-EXOMailbox-ResultSize Unlimited|`Get-EXOMailboxStatistics|`Where-Object{[int64]($PSItem.TotalItemSize.Value-replace'.+\(|bytes\)')-gt"5MB"}|`Sort-ObjectTotalItemSize-Descending|`Select-ObjectDisplayName,ItemCount,TotalItemSize,LastLogonTime ...
Default value: Current user Required: False Accept pipeline input: False Accept wildcard characters: False -FilterHashtable Specifies a query in hash table format to select events from one or more event logs. The query contains a hash table with one or more key/value p...
A command to clear the value of a property of an item at a specified path. ClearRecycleBinCommand Defines the implementation of the 'Clear-RecycleBin' cmdlet. This cmldet clear all files in the RecycleBin for the given DriveLetter. If not DriveLetter is specified, then the RecycleBin for...
#Get Disk space using WMI and make sure it is an array $Disks = @(Get-WMIObject Win32_LogicalDisk -filter "DriveType=3" ) #Remove all the current charts Clear-Chart $chart1 #Loop through each drive foreach($disk in $Disks) { $UsedSpace =(($disk.size - $disk.freespace)/1gb) $...
that has a type of ServiceController. It is a single value, but can be converted to an array consisting of a single element. The receivingparametertype now matches the sentobjecttype, and so itbindsor is associated with the objectvalue, which is also referred to as ...
One of the big problems we have had in the language has been not knowing whether the following expression was going to return a single element or an array: $x = gps $name We fixed this longstanding problem by masking over the issue allowing elements to be treated as arrays. e.g. ...