Esistono due modi per verificare la data di creazione di una Virtual Machine su Azure… o almeno che io conosca
Metodo 1 – Azure Portal
Se la virtual machine è stata creata negli ultimi 90 giorni, è possibile verificare la data di creazione dal portale Azure tramite il pannello “Activity Log” della VM stessa:
Autenticarsi sul portale Azure (https://portal.azure.com)
Cercare la VM che ci interessa
Dal menù di sinistra, selezionare Activity Log ed eventualmente utilizzare i filtri per filtrare l’intervento di date interessate
Metodo 2 – Azure Powershell
Tramite l’Activity Log possiamo risalire fino a 90 giorni prima. Nel caso la VM sia stata creata da più 90 giorni, bisogna ricorrere a Powershell:
Azure File Sync (AFS) è il servizio di Microsoft che permette di centralizzare i file aziendali in Azure tramite l’installazione di un agente di sincronizzazione installato sul server, sia in Azure che on-premise.
Una volta installato, di default, AFS sfrutta tutta la banda internet disponibile per la sincronizzazione dei dati (sia in upload che in download). Questo comportamento potrebbe però portare a dei malfunzionamenti agli altri workload, nasce quindi la necessità di limitare la banda utilizzata dal servizio.
E’ possibile limitare l’utilizzo della banda da parte di Azure File Sync tramite comandi Powershell (non è possibile da interfaccia grafica).
Importare il modulo AFS Import-Module “C:\Program Files\Azure\StorageSyncAgent\StorageSync.Management.ServerCmdlets.dll”
Configurare la regola di QoS. In questo esempio la banda viene limitata dal lunedì al venerdì e dalle 09 alle 19 a 2 Mpbs: New-StorageSyncNetworkLimit -Day Monday, Tuesday, Wednesday, Thursday, Friday -StartHour 7 -EndHour 19 -LimitKbps 2000
Verifica della regola configurata: Get-StorageSyncNetworkLimit
NOTA: le regole che si configurano influenzano solo il download del dato e non è possibile governare il download del dato, almeno nella data in cui scrivo (16 – 01 – 2010)
Lo script sotto esegue l’autenticazioni su sottoscrizioni Azure di tipo CSP e la selezione della sottoscrizione da utilizzare tramite due menù di scelta.
<#
Requirement:
Powershell 5.1
Module:
- Partner Center
- Az
#>
Import-Module PartnerCenter
Connect-PartnerCenter
# Select customer
$customer = Get-PartnerCustomer | Out-GridView -Title "Select the partner and click OK" -PassThru
Login-Azaccount -TenantId $customer.CustomerId
# Select subscription
$Subscription = Get-AzSubscription | Out-GridView -Title "Select the Subscription and click OK" -PassThru
Select-AzSubscription -SubscriptionId $Subscription.Id -TenantId $Subscription.TenantId
Volendo, è possibile memorizzare le credenziali per evitare che vengano richieste due volte tramite il cmdlet “get-credential”. Nel momento in cui sto scrivendo, parrebbe che il comando “connect-partnercenter” generi un errore nel passaggio delle variabili (nonostante il fatto che l’autenticazione si concluda comunque con successo).
Disclaimer: nessuna garanzia è fornita con questo script. Lo scrivente non è responsabile di qualunque danno possa eventualmente derivarne – lo utilizzate a vostro rischio.
Scenario. Server con installata la console di Enterprise Vault. Script per l’esportazione degli archivi in PST (requisito: da avviare in Poweshell 23 bit) Verifica se il modulo è di Etnerprise Vault è installato if (!(Get-Module "enterprisevault")) {import-module enterprisevault} $exportTOpst = import-csv "C:\temp\test.csv" -Delimiter ";" foreach ($archive in $exportTOpst){ Write-Host -ForegroundColor Magenta "Dearchiviazione dell'archivio "$archive.ArchiveName Export-EVArchive -ArchiveId $archive.archiveID -Format PST -OutputDirectory D:\Temp -MaxPSTSizeMB 51200 }
Problema Durante l’esecuzione dello script, viene generato l’errore “could not load file or assembly kvs.enterprisevault.interop.evpstapi”
Soluzione Copiare nella directory di installazione di Enterprice Valut (p.e. C:\Program Files (x86)\Enterprise Vault) il file KVS.EnterpriseVault.Interop.EVPstApi.dll (presente nel server EV) e riavviare i servizi di EV
Script per configurare la scheda di rete in DHCP o con IP statico. Permette di scegliere quale scheda di rete configurare.
function show-menu-DHCP-or-static
{
cls
Write-Host "Press '1' DHCP"
Write-Host "Press '2' Static"
}
function DHCP {
$IPtype = "IPv4"
$interface = $adapter | Get-NetIPInterface -AddressFamily $IPtype
If ($interface.Dhcp -eq "Disabled") {
# Remove existing gateway
Write-Host "Removing existing gateway"
If (($interface | Get-NetIPConfiguration).Ipv4DefaultGateway) {
$interface | Remove-NetRoute -Confirm:$false
}
# Enable DHCP
Write-Host "Enabling DHCP on interface"
$interface | Set-NetIPInterface -DHCP Enabled
# Configure the DNS Servers automatically
Write-Host "Enabling automatic DNS"
$interface | Set-DnsClientServerAddress -ResetServerAddresses
}
}
function Static-IP {
#Variable
$IP = Read-Host "IP Address"
$CIDR = Read-Host "CIDR"
$GW = Read-Host "Gateway"
$DNS = Read-Host "DNS"
$IPtype = "IPv4"
# Remove any existing IP, gateway from our ipv4 adapter
If (($adapter | Get-NetIPConfiguration).IPv4Address.IPAddress) {
Write-Host "Removing existing IP"
$adapter | Remove-NetIPAddress -AddressFamily $IPType -Confirm:$false
}
If (($adapter | Get-NetIPConfiguration).Ipv4DefaultGateway) {
Write-Host "Removing existing gateway"
$adapter | Remove-NetRoute -AddressFamily $IPType -Confirm:$false
}
# Configure the IP address and default gateway
Write-Host "Configuring new IP"
$adapter | New-NetIPAddress -AddressFamily $IPType -IPAddress $IP -PrefixLength $CIDR -DefaultGateway $GW
# Configure the DNS client server IP addresses
Write-Host "Configuring new gateway"
$adapter | Set-DnsClientServerAddress -ServerAddresses $DNS
}
#Selection NIC
$nic = Get-NetAdapter | select name
For ($i = 0; $i -lt $nic.Length; $i++){
$str = ($i + 1).ToString();
$str = $str + " - ";
$str = $str + $nic[$i].name;
Write-Host($str);
}
$response = Read-Host "Type the network number";
$SelectedNic = $nic[$response-1].name;
$adapter = Get-NetAdapter | Where-Object {$_.Name -eq $SelectedNic}
###
#DHCP or Static
show-menu-DHCP-or-static
$Input = Read-Host "Please make a selection"
switch ($input) {
'1' {
$Type = 'DHCP'
DHCP
}
'2' {
$Type = 'Static'
Static-IP
}
}
Disclaimer: nessuna garanzia è fornita con questo script. Lo scrivente non è responsabile di qualunque danno possa eventualmente derivarne – lo utilizzate a vostro rischio.
Script per esportare, esportare ed importare o importare soltanto le claim AD FS.
Add-PSSnapin "Microsoft.ADFS.PowerShell" -ErrorAction SilentlyContinue
$select = Write-Host "Select operation: (1)Export; (2) Export and Import; (3) Import "
$XMLFilePath = "RPTClaim.xml"
function show-menu
{
cls
Write-Host "==========Export Import AD FS Claim=========="
Write-Host "Press '1' for Export"
Write-Host "Press '2' for Export and Import"
Write-Host "Press '3' for Import"
}
function export
{
$SourceRelyingPartyTrust = Read-Host "Source Relying Party Trust" #Display Name of Source Relying Party Trust
Get-ADFSRelyingPartyTrust -Name $SourceRelyingPartyTrust | Export-Clixml $XMLFilePath
Write-Host "Relying Party Trust Claim Rules Exported"
}
function import{
$TargetRelyingPartyTrust = Read-Host "Target Relying Party Trust" #Display Name of Target Relying Party Trust
Import-Clixml $XMLFilePath | foreach-object {Set-ADFSRelyingPartyTrust -TargetName $TargetRelyingPartyTrust -IssuanceTransformRules $_.IssuanceTransformRules}
Write-Host "Relying Party Trust Claim Rules Imported"
}
function export-import
{
export
import
}
show-menu
$input = Read-Host "Please make a selection "
switch ($input)
{
'1'
{
cls
export
}
'2'
{
cls
export-import
}
'3'
{
cls
import
}
}
Disclaimer: nessuna garanzia è fornita con questo script. Lo scrivente non è responsabile di qualunque danno possa eventualmente derivarne – lo utilizzate a vostro rischio.
Si ha l’esigenza, molte volte, di dover aprire le MMC (ad esempio i tools per la gestione di Active Directory) con credenziali differenti rispetto al dominio di appartenenza. Occorre quindi utilizzare il comando Runas con lo switch netonly.
Il comando, per esempio, per eseguire la MMC di Active Directory Users and Computers è:
Ho configurato uno script in Powershell con le MMC di Active Directory Management Tools:
function Show-Menu
{
param (
[string]$Title = 'Runas_MMC.ps1'
)
cls
Write-Host "================ $Title ================"
Write-Host "1: Press '1' for Active Directory Users and Computers."
Write-Host "2: Press '2' for Active Directory Sites and Services."
Write-Host "3: Press '3' for Active Directory Domain and Trusts."
Write-Host "4: Press '4' for ADSI Edit."
Write-Host "Q: Press 'Q' to quit."
}
do
{
Show-Menu
$input = Read-Host "Please make a selection"
$server = Read-Host "Server"
$user = Read-Host "Domain\User"
switch ($input)
{
'1' {
cls
runas.exe /netonly /user:"$user" "mmc c:\windows\system32\dsa.msc /server=$server"
}
'2' {
cls
runas.exe /netonly /user:"$user" "mmc c:\windows\system32\dssite.msc /server=$server"
}
'3' {
cls
runas.exe /netonly /user:"$user" "mmc c:\windows\system32\domain.msc /server=$server"
}
'4' {
cls
runas.exe /netonly /user:"$user" "mmc c:\windows\system32\adsiedit.msc /server=$server"
}
'Q' {
return
}
}
pause
}
until ($input -eq 'q')
Esecuzione dello script
E’ possibile modificare lo script aggiungendo o eliminando le varie console.
Disclaimer: Nessuna garanzia è fornita con questo script. Lo scrivente non è responsabile di qualunque danno possa eventualmente derivarne – lo utilizzate a vostro rischio.
Montare la ISO. Per comodità, l’ho scompattata sul disco locale nel percorso: c:\NanoServer\Files
All’interno della directory locale C:\NanoServer, oltre al contenuto della ISO, ho copiato i moduli Powershell.
NanoServer Folder
Da Powershell:
#Preparazione area di lavoro
cd C:\NanoServer
Import-Module .\NanoServerImageGenerator.psm1
#Creazione del VHDX
New-NanoServerImage -MediaPath .\Files -BasePath .\Base -TargetPath .\Images\NanoServer.vhdx -MaxSize 20GB -DeploymentType Guest -Edition Datacenter -ComputerName "NanoServer"
Dove:
MediaPath: percorso di dove sono memorizzati i file di Windows Server 2016
BasePath: Percorso dove vengono memorizzati i dati temporanei
TargetPath: percorso dove verrà memorizzato il disco creato. VHD per VM di Generazione 1, VHDX per VM di Generazione 2
MaxSize: dimensione massima del disco. Nel caso non venga inizializzato questo valore, il valore di default è 4 GB.
DeplymentType: Guest per macchine virtuali, Host per macchine fisiche
Edition: Standard o Datacenter
ComputerName: nome della macchina
Per l’elenco completo dei parametri, fare riferimento alla TechNet: https://technet.microsoft.com/itpro/powershell/windows/nanoserverimagegenerator/new-nanoserverimage
Collegare il disco in una nuova macchina virtuale Hyper-V e avviarla.
NanoServer in Hyper-V
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Durata
Descrizione
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.