PowerShell: Waiting for jobs to complete with Wait-Job
SID-500.COM
by Patrick Gruenauer
1w ago
The cmdlet Wait-Job waits until one or all of the PowerShell jobs running in the session are in a terminating state. In this blog post I will show you an example you can build on. Let’s get started. Start-Job creates one or more PowerShell background jobs. These jobs are running hidden in the background and enable you to continue your work in PowerShell. This example starts a port scan background job. Start-Job -Name PortScan -ScriptBlock {Test-NetConnection 192.168.0.150 -Port 88} Get-Job -Name PortScan To display the results of this job, run Receive-Job. Note that you can display the ..read more
Visit website
Exchange Online: Message Tracking with PowerShell
SID-500.COM
by Patrick Gruenauer
2w ago
Message tracking in Exchange Online can be performed graphically as well as in PowerShell. In this post I will show how to track messages with PowerShell. And you will get a script which you can use in your environment. Let’s jump in. Prerequisites If not already done, we need to install the Exchange Online Management Module and connect to Exchange Online. Install-Module ExchangeOnlineManagement -Force -AllowClobber Connect-ExchangeOnline Message Tracking in PowerShell Next, I’ll show you 4 examples of how you can perform message tracking for a mailbox to display the output either in the co ..read more
Visit website
Active Directory: How to perform an Offline Domain Join
SID-500.COM
by Patrick Gruenauer
1M ago
What sounds strange actually works. An offline domain join. Why do you need an offline domain join? Maybe you want to order a completely finished PC from your supplier, which is already joined to the domain without ever having had contact to this domain. Let’s get started. Steps on the Domain-Controller Open PowerShell ISE oder VS Code. Provide the domain name and computer name. Then run djoin to deploy your client to the domain. $domain = 'pagr.inet' $comp = 'catvie-002' djoin /provision /domain $domain /machine $comp /savefile $home\$comp.txt The file should look like this. Transfer this ..read more
Visit website
Visual Studio Code: How to enable Cloud Sync
SID-500.COM
by Patrick Gruenauer
2M ago
VS Code is supposed to be the successor of PowerShell ISE. The flexibility of VS Code is enormous, yet there are not only fans of VS Code. To make it easier to get started, I always recommend to activate the Cloud Sync so that VS Code has the same look on all computers and also the extensions are automatically adapted and installed. Let’s get started. In this post I will show you how to enable Cloud Sync. Turning on Cloud Sync Install and open VS Code. Click on the icon on the left side to open the Sync menu. Next, click on Sign in to Sync Settings. A browser window opens. Enter your credent ..read more
Visit website
PowerShell: How to ping multiple Computers at once
SID-500.COM
by Patrick Gruenauer
2M ago
You want to ping multiple computers at once? Can’t? Yes you can, with PowerShell. In this post I’ll show you a few examples of how you can ping multiple computers. We will use the Test-Connection cmdlet for this task. It’s going to be exciting. Let’s get started. Open PowerShell 5.1 or PowerShell 7. Example 1: Ping multiple Computers Test-Connection -ComputerName sid-500.com,192.168.0.1,microsoft.com -Count 1 Example 2: Ping all Domain-Computers Test-Connection -ComputerName (Get-ADComputer -Filter * | Select-Object -ExpandProperty Name) -Count 1 Example 3: Ping Computers from Text File ..read more
Visit website
Exchange Online: How to set Junk Settings for Shared Mailboxes
SID-500.COM
by Patrick Gruenauer
4M ago
When working with shared mailboxes, there is a problem: the user connected to this mailbox cannot configure the Junk Mail Settings for this shared mailbox in Outlook itself. In this blog post I show how to configure the junk mail settings for a shared mailbox using the Exchangen Online module and PowerShell. Prerequisites If you have not already done so, install the Exchange Online module. Open PowerShell and enter the following line. Install-Module -Name ExchangeOnlineManagement -Force -AllowClobber Next, we connect to Exchange Online. Connect-ExchangeOnline Action In my case I use the ..read more
Visit website
Active Directory: How to retrieve the Domain SID
SID-500.COM
by Patrick Gruenauer
5M ago
Recently I needed the domain SID to configure MFA with a 3rd party tool. Where can I get the domain SID? That’s exactly what I will show in this blog post. Let’s get started! Retrieving Domain SID Open PowerShell. Hit the keys and enter the One-Liner below to retrieve the Domain SID of your Active Directory Domain. (Get-ADDomain).DomainSID.Value With this command the domain SID is not displayed, it is copied to the clipboard. (Get-ADDomain).DomainSID.Value | Set-Clipboard To save the domain SID to a file execute the following command. (Get-ADDomain).DomainSID.Value | Out-File $home ..read more
Visit website
PowerShell: Search for Empty Folders (and delete them)
SID-500.COM
by Patrick Gruenauer
5M ago
We live in times of Big Data. Too much data in too short a time. You may have empty folders in your environment and if you want to search for them and delete them then you are at the right place. We will do just that. Run this little script below to remove all empty folders. At the top you need to specify the path to the root folder. In my case this is C:\Data. You will be asked to confirm the deletion. # Folder empty, then remove them $path = 'C:\Data' Get-ChildItem $path -Recurse -Directory | ForEach-Object { If((Get-ChildItem $_.FullName) -eq $null) { Remove-Item -Path $_.Fu ..read more
Visit website
PowerShell: List and document all Hyper-V VMs with the most important properties
SID-500.COM
by Patrick Gruenauer
6M ago
So you have multiple Hyper-V VMs and may have lost track of them. In this post I will show you how to retrieve all Hyper-V VMs with the most important properties and settings. With PowerShell of course – what else. Run this little nice script to get the most important properties of your VMs. Get-VM | Select-Object Name,ProcessorCount,` @{name='MemoryStartup';expression={[math]::Round($_.MemoryStartup/1GB,0).tostring() + ' GB'}},` @{name='MemoryAssigned';expression={[math]::Round($_.MemoryAssigned/1GB,0).tostring() + ' GB'}},` @{n='Uptime';e={(Get-Date) - $_.Uptime}},State,Version | Format-Ta ..read more
Visit website
Active Directory: List all Network Shares from all Windows Servers
SID-500.COM
by Patrick Gruenauer
6M ago
In today’s blog post I show how to retrieve all network shares from all servers in an Active Directory domain to get a nice list in the output. This script is used to document your Active Directory environment. Let’s get started. Retrieve all Server by Name First of all, we need to retrieve the server names. # Retrieve Server Names $server = Get-ADComputer -Filter 'operatingsystem -like "*server*"' | Select-Object -ExpandProperty Name Short review. Great! Retrieving all Share Names of all Servers Now the party begins. Since we have all the server names, we can use Invoke-Command and Get-S ..read more
Visit website

Follow SID-500.COM on FeedSpot

Continue with Google
Continue with Apple
OR