[Powershell-Remoting] Strange behavior from $using

Hello there Guys/Gals, i have encountered a rather strange issue with powershell-remoting. I have created an ADSI-Object from an user with a ldap-query. with this i am going to the DomainController via Invoke-Command $session $scriptblock. if the Userinput ($using:User) is filled with all necessary attributes, the script is running just fine. However, i am referencing […]

Probably making a stupid error but having trouble with string matching in an If statement.

$title = “Senior Operator” If ($title -notlike “*director*” -or $title -notlike “*senior*” -or $title -notlike “*associate*” -or $title -notlike “*manager*”) { Write-Host “Title does not match director, senior, associate, or manager. Disabling OWA Web access.” Set-CASMailbox -Identity $emailaddress -OWAEnabled $False } Else { Write-Host “Title matches, leaving OWA enabled” The title has “senior” in it, […]

How to add additional custom columns when using Get-AdUser export in Excel

Hello! I’m trying to export the following to an Excel sheet. I’m trying to add additional columns that has information not relating to the export I want to include in the excel sheet. Get-ADUSer FriskyDuck -Properties employeeID, mail, telephonenumber | Select-Object -Property employeeID, @{Name=’Username’; Expression = {$_.samaccountname}}, @{Name=’Primary Email’; Expression = {$_.mail}}, @{Name=’Work Phone’; Expression […]

Start-Sleep in a Try/Catch

Hello folk of /r/PowerShell I’ve got a script that installs a SCCM client using PSEXEC to a targeted workstation. As a lazy solution I’ve got a Start-Sleep -Seconds 300 in place of tracking the Setup.exe’s progress. It appears to be skipping the Start-Sleep. Try { Remove-Item -Path “\$computerc$tempClient” -Recurse -Force -ErrorAction SilentlyContinue Write-Host “Copying files […]