Posted on

Trovare un computer usando il MAC Address

Procedura valida per i sistemi Windows

ARP

Lanciare il comando  (usato per questo test un domain controller)

arp -a

Avrete la lista di tutti gli ip di rete e  del relativo Mac Address

PING

Se in questa lista trovate il MAC address che state cercando, prendete nota del suo indirizzo ip e trovate il nome usando il comando

ping -a IP

 

 

Posted on

How to Deploy ASP.NET Core Web API on IIS Windows Server

(Tested on windows server 2012r2)

Install the .NET Core Hosting Bundle on Windows Server

The .NET Core Hosting bundle is an installer for the .NET Core Runtime and the ASP.NET Core Module. The bundle allows ASP.NET Core apps to run with IIS.

Current version:.NET Core Hosting Bundle installer (direct download)

(for this test we installed version .Net Core 8 on win 2012r2)

Visual Studio : Publish on Folder

After creating the ASP.NET Core application in Visual Studio, we can use the Visual Studio Publish Tool to deploy and run our app. For this project, choose to publish to a folder. Choose the folder and hit “Finish”.

In the next screen, where you see the settings for this deploy, click on “More Actions” and then on “Edit”.

Select :

  • Deployment Mode : Complete
  • Target Runtime : win-x64 (for our server)
  • File Publish Options : Delete all existing files prior to publish (flagged)
  • Database : Default Connection edit (if yuu need it)

Save this configuration, control it an Publish.

Copy the contents of the folder on the IIS server to the folder dedicated to the new site.

IIS and new site

Create the site on IIS. For the Application Pool you have to use default .NET CLR Version : v4.0.

Open your browser and call up the site. You receive the “page not found” error (404).

Remember that a site that hosts only calls web api. To verify that it works you can use the controller that Visual Studio sets by default when creating a site. Then type:

https://www.mynewapisite.com/WeatherForecast

and you will get a result. The site works!


Posted on

Esportazione di una macchina virtuale Hyper-v

Per esportare una macchina virtuale Hyper-v è necessario aprire powershell con permessi amministrativi ed eseguire il seguente comando :

Export-VM -Name <virtual machine name> -Path <path>

Errore sulla rete

Nei nostri test ci siamo resi conto che il comando è sempre valido quando il path di destinazione è una cartella del server mentre ci sono difficolta se il path di destinazione è una cartella in rete. In particolare non siamo riusciti ad esportare direttamente su una cartella Linux (es. nas) perché l’esportazione viene eseguita dall’account System.

Vedi documentazione Microsoft

Posted on

Chi può aggiungere una workstation al dominio Active Directory ?

A default tutti gli utenti di dominio hanno la capacità di aggiungere una workstation al dominio.

Limiti sul numero

Il limite a questa attività è che un qualsiasi utente può aggiungere un massimo di 10 workstation al dominio.

Impatto

Quando l’utente raggiunge il numero massimo di computer inseriti a dominio , riceve questo messaggio di errore

Chi ha aggiunto una workstation ad active directory ?

Per saper chi ha aggiunto una workstation ad active directory è suffico9enbte lanciare quiesto script ppowershell creato sulla base di questo articolo :

Using PowerShell to Discover Who Added a Client to Your Domain

Clear-Host

Write-Host "I'm writing ms-DS-MachineAccountQuota"

# List the current value of ms-DS-MachineAccountQuota
Get-ADDomain | 
Select-Object -ExpandProperty DistinguishedName | 
Get-ADObject -Properties 'ms-DS-MachineAccountQuota' | 
Select-Object -ExpandProperty ms-DS-MachineAccountQuota




Write-Host "Number clients in this environment"
Get-ADComputer -Filter * | Measure-Object | Select-Object -ExpandProperty Count
Write-Host "Number users in this environment"
Get-ADUser -Filter * | Measure-Object | Select-Object -ExpandProperty Count


Write-Host ""
Write-Host "Who did this?"
$Clients = Get-ADComputer -Properties ms-ds-CreatorSid, WhenCreated -Filter {ms-ds-creatorsid -ne "$Null"}
$Users = Get-ADUser -Filter *

ForEach ($C in $Clients)
{
ForEach ($U in $Users) 
{
If ($U.Sid -eq $C.'ms-ds-creatorsid')
{
$C | Select-Object -Property @{
Name = 'ComputerName'; Expression = {$C.Name}},
@{Name = 'WhenCreated'; Expression = {$C.WhenCreated.DateTime}},
@{Name = "UserName"; Expression = {$U.Name}
}
}
}
}

Modificare il limite del numero di workstation

E’ possibile modificare questo numero aumentandolo oppure portandolo a 0. Se si porta a 0, gli utenti dovranno avere particolari permessi per poter inserire un computer a dominio.

Per farlo, dal domain controller, lanciare il comando adsiedit.msc.

A sinistra posizionatevi sul nodo principale che comincia con “DC=…”. Tasto destro del mouse -> Proprietà . La chiave con il numero da modificare è MS-DS-MachineAccountQuota.

 

Limitare l’aggiunta di una workstation al dominio ad un gruppo

E’ possibile limitare ad un gruppo di utenti la capacità di aggiungere workstation al dominio , agendo direttamente sulle GPO

Computer Configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment

Cercare la voce “Add workstations to the domain” e modificatela per specificare solo gli utenti e gruppi che possono eseguire l’operazione di aggiunta.

Posted on

AD – Active Directory – Export Users Password Expiration Date to a file

how to get the password expiration date for Active Directory User Accounts.

Open PowerShell and run the command

$ExportPath = 'c:\temp\passwordexpiration.csv’
Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" |
Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | Export-Csv -NoType $ExportPath
Posted on

Active Directory : cambio ruoli server

In un ambiente windows server active directory nultiserver, può essere necessario spostare il ruoli da un server ad un altro.

Quale server ha i ruoli di Active Directory ?

Per scoprire quale server ha i ruoli di Active directory digitare il comando :

NETDOM QUERY FSMO

Trasferimento ruoli con riga di comando.

Aprire un prompt di Dos e digitare :

ntdsutil

poi

roles

poi

connections

poi

Connect to server ServerFQDN

Dove il server è il server a cui volete passare i ruoli

quit

A seconda dei ruoli che si vuole passare , digitare i seguenti comandi :

Ruolo Credenziali Comando
Master per la denominazione dei domini Amministratori Enterprise Seize naming master
Master schema Amministratori schema Seize schema master
master dell’infrastruttura Domain Admins Seize infrastructure master
Master per l’emulatore PDC Domain Admins Seize pdc
master RID Domain Admins Seize rid master
Posted on

microsoft wsus : questions and answers

How to update group policy on a client ?

gpupate /force

Which wsus server is registered on a client ?

REG QUERY "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate"

How to print group policy group for a client on screen ?

Gpresult /r

How to  confirm whether the update has been downloaded on the WSUS server first ?

Add file staus option. In wsus , in update window, right click on grid header and select “File Status”. The green icon means that the update is ready for installation.

How to get update log in a client via PoerShell ?

Open Powershall with admin privileges and digit :

Get-WindowsUpdateLog

This command will build a wsus client log on desktop.

How to remove a windows computer from wsus updating

Posted on

Exchange – cassette postali condivise

Le cassette postali condivise consentono a un gruppo di persone di monitorare e inviare posta elettronica da un indirizzo di posta elettronica comune, come info@mecdata.it. Quando un utente del gruppo risponde a un messaggio inviato alla cassetta postale condivisa, il messaggio di risposta sembrerà inviato dalla cassetta postale condivisa, non dal singolo utente.

Le cassette postali condivise vengono usate quando più persone devono accedere alla stessa cassetta postale, ad esempio un’informazione aziendale o un indirizzo di posta elettronica di supporto, una reception o un’altra funzione che potrebbe essere condivisa da più persone.

Le cassette postali condivise includono un calendario condiviso ed una rubrica condivisa.

Licenze: La cassetta postale condivisa può archiviare fino a 50 GB di dati senza assegnare una licenza. Per volumi più elevati, è necessario assegnare una licenza alla cassetta postale

Utenti esterni: Non è possibile concedere agli utenti esterni all’azienda (ad esempio, utenti con un account Gmail) l’accesso alla cassetta postale condivisa

Conversione delle cassette postali: È possibile convertire le cassette postali utente in cassette postali condivise.

Troppi utenti: Quando sono presenti troppi utenti designati che accedono contemporaneamente a una cassetta postale condivisa (è consigliabile non più di 25), è possibile che non riescano a connettersi a questa cassetta postale o abbiano incoerenze come i messaggi duplicati nella posta in uscita