Açıklaması şöyle
In a nutshell, Write-Host writes to the console itself. Think of it as a MsgBox in VBScript. Write-Output, on the other hand, writes to the pipeline, so the next command can accept it as its input.
In a nutshell, Write-Host writes to the console itself. Think of it as a MsgBox in VBScript. Write-Output, on the other hand, writes to the pipeline, so the next command can accept it as its input.
$software = Read-Host "Software you want to remove"$Credentials = ...$Computeters = ...foreach ($Computer in $Computers$MyScriptBlock = {param($Computer,$Credentials)...}Invoke-Command -ScriptBlock $MyScriptBlock -ArgumentList ($Computer, $Credentials)}
function Check-Update {
Param(
[Parameter(Mandatory=$True, Valuefrompipeline=$True)]
[Validatenotnullorempty()]
[String]$Path
)
$IsGood=$false
if ($(Test-Path $Path) -and $Path.EndsWith(".msu")) {
...
} else {
Write-Error -Message "Update file: $path doesn't exist as a valid update file"
}
}Function New-Ping {
Param(
[Parameter(Mandatory)]
[string]$ComputerName,
[Parameter(Mandatory)]
[int]$Intervall
)
while ($true) {
Test-Connection $ComputerName -Count 1
Start-Sleep -MilliSeconds $Intervall
}
}New-Ping ServerName 500while ($true) { Test-Connection ServerName -Count 1 ; Start-Sleep -MilliSeconds 500 }Remove-Item *.tmp or any of its aliases like rm *.tmp, del *.tmp
CMD Example:del TestItem.txtPowershell Example:remove-item TestItem.txt
$mydirectory ="..."$excludedirectory1 ="..."$excludedirectory2 ="..."Remove-Item $mydirectory\* -Exclude $excludedirectory1 $excludedirectory2 -Recurse
-Force -ErrorAction Ignore