Disable / remove "Choose privacy settings for you device" - azure-virtual-machine

I have an Azure VM scale set based on a Microsoft Windows 10 pro image.
Then I login the first time Im greeted with a "Choose privacy settings for you device"
I'm pretty sure I can turn it off via a regedit option. But I simplicity can not figure out which. Does anyone know how I avoid that screen image when I log on for the first time?

You can disable it from Local Group Policy Editor.
Open local group policy editor
In the left pane of Local Group Policy Editor, navigate to the location below.
Computer Configuration\Administrative Templates\Windows Components\OOBE
In the right pane of OOBE, double click/tap on the Don't launch privacy
settings experience on user logon policy to edit it.To Disable Privacy Settings
Experience at Sign-in, Select Enabled, click/tap on OK, and apply.

I solved this by creating these four reg keys, which are then executed using a custom script extension:
New-ItemProperty -Path "HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" -Name "PrivacyConsentStatus" -Value 1 -PropertyType DWORD -Force
New-ItemProperty -Path "HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" -Name "SkipMachineOOBE" -Value 1 -PropertyType DWORD -Force
New-ItemProperty -Path "HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" -Name "ProtectYourPC" -Value 3 -PropertyType DWORD -Force
New-ItemProperty -Path "HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" -Name "SkipUserOOBE" -Value 1 -PropertyType DWORD -Force

Related

How to expand multiple Properties in json output (ConvertFrom-Json/ConvertTo-Csv)

Running a AWS CLI command for AWS to export all the subnets. Then running the below in PowerShell. When doing this, there are a couple fields (Tags, CIDR Blocks) that output as just "System.Object[]" in the CSV. If i could get them to expand or 'be selected' would be great. Specifically, I only really want the tag: "Name", but i'll take w/e is easier.
Get-Content -Path C:\Working\subnets.json |
ConvertFrom-Json |
Select-Object -expand * |
ConvertTo-Csv -NoTypeInformation |
Set-Content C:\Working\subnets12.csv
json was created from: aws ec2 describe-subnets --output=json
then, copied and pasted everything inside the { } into a text file.
I assume there is a better way to create the json file from bash prompt. And, might even be able to convert to csv from bash instead of PowerShell.
I was expecting to be able to get a CSV that had all the details from the original json file.

Get-WmiObject Win32_ServerFeature Access Remote Server Roles and features

Accessing Roles and Features from the Remote server.
i tries the following PowerShell script to get the roles and features from the remote server.
Get-WmiObject -Computer "serverName" -query 'select * from Win32_ServerFeature'
but the problem is i could not identify additional details like if the given object from the collection is Feature or role. Any help please?
Finally i found another alternative by using Get-WindowsFeature -ComputerName where i can filter featuretype and get separate results for roles and features for remote machines.
For example:
Get-WindowsFeature -ComputerName $ServerName | Where-Object {($_.InstallState -eq “installed”) -and ($_.FeatureType -eq “Role Service”)}

How to deploy or delete several virtual machines at once with Azure PowerShell?

How can I do multiple operations on multiple VM's like creating or deleting 10 VM's through Azure PowerShell scripts?
Generally, we deploy a bunch of VMs in order to increase the availability and reliability of Virtual Machine solutions on Azure using Availability Sets or manage a set of identical, auto-scaling virtual machines using virtual machine scale sets.
In this case, if you just want to deploy a volume of VMs once time. You can use a for loop with powershell. For example, you create two VMs as following steps:
Create a resource group
New-AzureRmResourceGroup -ResourceGroupName "ResourceGroupVM" -Location "EastUS"
Create 2 VMs using FOR loop.
for ($i=1; $i -le 2; $i++)
{
$cred = Get-Credential
New-AzureRmVm `
-ResourceGroupName "ResourceGroupVM" `
-Name "myVM$i" `
-Location "East US" `
-VirtualNetworkName "myVnet" `
-SubnetName "mySubnet" `
-SecurityGroupName "myNetworkSecurityGroup" `
-PublicIpAddressName "myPublicIpAddress$i" `
-Credential $cred
}
Remove your resource group to remove VMs.
Remove-AzureRmResourceGroup -Name "ResourceGroupVM" -Force
However, it is recommended to use the template to deploy many independent VMs. You can create a template file that deploys the resources and a parameters file that supplies parameter values to the template. Then deploy the template. Using template is a more flexible method to deploy many personalized VMs that you can specific lots of properties (e.g. virtual network, subnet, load balancer configs, etc.)

Unable to save/modify imported build definition in VSTS

I am attempting to export a build from one project to another. Projects are in different collections. I have collection admin so perms should be good, but just to be sure I granted myself build and project admin.
I exported the build as json using the VSTS UI in the source project then imported in the target project. All the tasks are present, but the parameters are grayed out. I also cannot enable/disable tasks. There are some parameters that need to be filled in such as build agent. I was able to select the appropriate agent. I have no outstanding items at this point that the UI is indicating I would need to address prior to saving. The save, discard, queue options are all grayed out.
I can add a new phase, but I can't add any tasks to that phase. I also tried bringing up the yaml and compared it to the yaml in the source project, no differences.
Why can't I save my imported build definition?
Import succeeded after replacing all instances of the project and collection ids in the json I was attempting to import. At the time of this post those changes must be completed manually.
UPDATE:
I tried just removing the offending properties rather than replacing them and that worked. I created a simple script to clear out those properties:
Param(
[parameter(Mandatory=$true)]
[alias("p")]
$path
)
$removeProperties = #("triggers","metrics","_links","authoredBy","queue","project")
$json = Get-Content -Path $path -Raw | ConvertFrom-Json
foreach ($property in $removeProperties) {
$json.PSObject.Properties.Remove($property)
}
$json | ConvertTo-Json -Depth 100 | Set-Content -Path $path -Force

amazon EC2 command line interface not returning all my snapshots

So I am tasked with creating a Batch script to handle creating and deleting snapshots of one of our servers. Well I have most of it working but the problem I am having is trying to list out more than 11 snapshots. We have well over 200 snapshots on one volume.
I've tried ec2-describe-snapshots -F "volume-id=vol-12345" -F "status=completed"|sort /R /+49 where vol-12345 is my volume id of course. That does do the proper sorting by date that I need but it still only returns 11 snapshots. I also tried to throw a -a at the end in case there were any private snapshots but I was still getting only 11.
I did see this post: how to list all the snapshots created from a single volume ID EC2 instance but that doesnt quite answer my question on how to display more than 11 snapshots. Any help on this would be greatly appreciated! Thanks.
Here's an alternative, using the AWS Tools for PowerShell. This utility should already be installed if your Windows EC2 is based off of an AMI that Amazon provided.
This example describes a collection of snapshots that you created, and is filtered by status "completed" and by your provided volumeId. It is sorted by StartTime.
# Create a filter to limit by status = completed
$filterByStatusCompleted = New-Object Amazon.EC2.Model.Filter -Property #{Name = "status"; Value = "completed"}
# Create a filter to limit by specific volume ID
$filterByVolumeId = New-Object Amazon.EC2.Model.Filter -Property #{Name = "volume-id"; Value = "vol-11111111"}
# Describe the collection of snapshots, sorted by StartTime
Get-EC2Snapshot -OwnerIds self -Filter $filterByStatusCompleted, $filterByVolumeId | Sort -Property StartTime
Documentation:
AWS Tools For PowerShell - Get-EC2 Snapshot