Thank you for writing this article.
I wrote all my own Powershell code to install VMs, but on the free Hypervisor-only platform. IMO, it is pointless to host VMs on a GUI based server. The command line based server has far less bloat and better security.Michael Pietroforte edited the doc How to create a Hyper-V VM with PowerShell in the group
PowerShell 15 hours, 44 minutes ago
In this new post of my Hyper-V management series, I will explain how create a Hyper-VM with PowerShell.
If you’re creating complex PowerShell scripts like this, you should already be aware that setting the AllowTelemetry key in the registry, will have the same effect as using the Local Group Policy Editor to set one on of the 4 allowed levels of Data Reporting. You should also be aware that setting it to Zero is only possible on Windows Enterprise and if you choose to do it anyway…. for example, if you set this key to 0 on a Windows Pro copy…. the system will revert to the level of Diagnostic Data that Microsoft sees fit, and this effect will be invisible. You can verify what I’m telling you by simply visiting the relevant Group Policy, setting it to 4 then refresh Regedit (press F5) and watch as the AllowTelemetry key changes to 4. If you’re not on Enterprise then then 1 is the lowest setting you can use.
Basically, if you don’t know what you’re doing by poking around in the registry, you may very well be enabling more Telemetry while you think you’re turning it off.
Key: HKLMSOFTWAREPoliciesMicrosoftWindowsDataCollection”AllowTelemetry”
Local Group Policy: Computer ConfigurationAdministrative TemplatesWindows ComponentsData Collection and Preview BuildsAllow Telemetry (it tells you that you can only set 0 if you’re running Enterprise.)
*I’d never recommend that anybody run a script that automatically makes a bunch of changes to their Windows in the hopes of tuning it for privacy reasons. The best thing to do is do the research yourself and understand what it is that you’ll be changing.
thank you great article
Nevor Yard commented on
How to create an open file/folder dialog box with PowerShell 4 days, 4 hours ago
Try this:
start $FileBrowser.filename
Robert Pearman wrote a new post,
Remove or block Chrome extensions with PowerShell 4 days, 15 hours ago
A comment on the previous post about deploying Chrome extensions posed the question of whether PowerShell could be used to remove Chrome extensions.
thanks for sharing!
i am looking to make a script to do a hot clone(booteable) of disk….its posible to achive that on windows?
Lets imagine:i have a 256 SSD disk with the default partitions that windows create….and a second HDD partition (lets say…500gb)
so idea will be create the same parttion structure in HDD and a extra partition to hold the image of the partitions of SSD…
launch in powershell the image of the parttions and hold in the extra partitions of HDD and then recover each image in the correspondent copied partitions of HDD…
have sense?
Jafar commented on
Add a domain user or group to local administrators with PowerShell 5 days, 17 hours ago
Hi,
Is there anyway to many different ad domain user on different client machines?
in one step?Regards
ErikN commented on
PowerShell advanced functions – The CmdletBinding and Parameter attribute 5 days, 19 hours ago
I guess something has changed in PowerShell in the past three years, because despite following this guide to the letter it doesn’t work as described. Not sure why.
That wast my mistake. The methods just also apply to the latest PowerShell versions. We changed the wording.Thanks for the hint!
You said you would discuss changes in version 7 and 7.2, but I didn’t find that in the article.
Sponsor posted an update in the group
PowerShell 6 days, 18 hours ago
Creating new VMs, managing snapshots and changing VM configurations are just a few examples of recurring to-dos where PowerShell can help to simplify VMware administration.
In this webinar, we will show you how to automate and delegate these tasks to helpdesk teams and even end users. This webinar is aimed at administrators, IT and DevOps professionals, PowerShell developers and IT managers.
Register for freeLeos Marek created the doc
How to check the PowerShell version 6 days, 18 hours ago
It is important for an administrator to know what Windows PowerShell and PowerShell edition and version are installed on a system, especially due to script compatibility. This article covers all the ways to check the PowerShell version on Windows, Linux, and MacOS and offers tips and tricks. I will also discuss the changes in PowerShell 7 and PowerShell 7.2.
Emanuel Halapciuc commented on
Change remote IP address and DNS entry with a PowerShell script 1 week, 3 days ago
Check out the difference between
[powershell]Get-NetAdapter | Select-Object -ExpandProperty InterfaceAlias[/powershell]
and
[powershell]Get-NetAdapter | Select-Object InterfaceAlias[/powershell]Do you catch the difference? That’s PowerShell-related, not Get-Netadapter related. 🙂
You may also use [powershell](Get-NetAdapter).InterfaceAlias[/powershell]
Cheers
Lee Roy Anthony commented on
Change remote IP address and DNS entry with a PowerShell script 1 week, 4 days ago
Hi Emanuel!
Every answer I get is like a new window of knowledge! Thank you!
I’ve actually used something similar to your 2nd suggestion. In fact, here’s my test code:
Invoke-Command -VMName Win10VMTest004 -ScriptBlock {
$InterfaceIndex = Get-NetAdapter | Select-Object InterfaceIndex
$InterfaceAlias = Get-NetAdapter | Select-Object InterfaceAlias
Write-Output $InterfaceAlias
If ($InterfaceAlias -eq “Ethernet 2”)
{
$InterfaceIndex = $InterfaceIndex4Set
Write-Output $InterfaceAlias, $InterfaceIndex4Set
}}However, using the 1st write-output that I’ve placed to trace where the process flows through, I’ve found out that it doesn’t enter or satisfy the IF statement. It displayed this:
InterfaceAlias PSComputerName RunspaceId
————– ————– ———-
Ethernet 2 Win10VMTest004 ffd983d1-21bf-42af-b123-bb0ec402dd3f
Ethernet Win10VMTest004 ffd983d1-21bf-42af-b123-bb0ec402dd3fI need to ‘catch’ Ethernet 2. Suspecting that the second value ‘Ethernet’ is overwriting the 1st value ‘Ethernet 2’, I’ve tested a code where the IF tries to catch ‘Ethernet’ only. To no avail.
You’re right, YouTube videos will surely do a lot of help also.
Thank you! Your replies are always very helpful and enlightening.
Michael Pietroforte edited the doc
How to install the PowerShell Active Directory module 1 week, 4 days ago
This guide has been updated for the latest Windows versions Windows 11 and Windows Server 2022. You’ll learn how to install the Active Directory (AD) module for PowerShell Core 6.0, PowerShell 7 and Windows PowerShell. For Windows PowerShell, the tutorial describes how to install the AD module for Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11 Windows Server 2008 R2, Windows Server 2012 R2, and Windows Server 2016, Windows Server 2010 and Windows Server 2022. You’ll also learn how to work with the AD module on other systems such as macOS or Linux with the help of PowerShell remoting.
Emanuel Halapciuc commented on
Change remote IP address and DNS entry with a PowerShell script 1 week, 4 days ago
Hi.
You can do it in several ways:(Get-NetAdapter).InterfaceIndex
or save everything in a variable and then use it in a similar way.
$Nics = Get-Netadapter
$Nics.InterfaceIndexor
Get-NetAdapter | Select-Object -ExpandProperty InterfaceIndex
These approaches are applicable to pretty much all PowerShell commands, not really to this one in particular. If you’re new with PowerShell, getting comfortable with these concepts will be of great help. There are quite a few PowerShell courses on Pluralsight that could be a boost for you at this stage (pretty much anything from Jeff Hicks would be an excellent choice, but start with the “beginner” courses). Pluralsight is not free, but it’s completely worth the investment, and it’s roughly the cost of a Netflix subscription. 🙂
(I’m not affiliated in any way with them, but it helped me and I learned a lot).
Alternately, there are tons of free resources on YouTube and elsewhere. The only limit is your time. And your curiosity. 🙂Lee Roy Anthony commented on
Change remote IP address and DNS entry with a PowerShell script 1 week, 5 days ago
Hi Emanuel!
This is great help. However, how do I get the value of InterfaceIndex only? If my guess is correct, the code you provided will dump all of what’s contained in Get-NetAdapter.
Thank you!
Emanuel Halapciuc commented on
Change remote IP address and DNS entry with a PowerShell script 1 week, 5 days ago
Hi, Lee Roy (and Anthony).
You could do something like
$info = Invoke-Command -ComputerName Dc01,FS03 -ScriptBlock {Get-NetAdapter}.
to store the info in the variable $info.However, for Get-Netadapter you don’t need Invoke-Command. Get-Netadapter can get info from remote systems .
$info = Get-NetAdapter -CimSession Dc01,FS03- Load More