18.5 C
Firenze
lunedì, Luglio 14, 2025
Home Blog Page 3341

WinRM and WinRS per la GESTIONE REMOTA di un SERVER

0

WinRm è un sistema di gestione “remota” per un server Windows. Da un “certo punto di vista” è un alias del comando PSEXEC. Ad esempio, può essere utilizzato per lanciare comandi PowerShell attraverso il protocollo HTTP.
WinRm, per essere utilizzato deve essere fatto SIA sul SERVER sia sul CLIENT.

Sul Server :
Avviare con c:> winrm quickconfig (aprirà una porta sul Firewall e avvierà il servizio)
c:> winrm e winrm/config/listener (questo comando darà una diagnostica e farà vedere che le default ports sono 5985 per HTTP e 5986 per HTTPS).
Impostare la BASIC Authentication : c:> winrm set winrm/config/service/auth @{Basic=”true”}
Impostare dati “non criptati” : c:> winrm set winrm/config/service @{AllowUnencrypted=”true”}
In caso di DOMINIO bisogna Utilizzare anche i TRUSTED HOST, con questo comando (esempio) : winrm set winrm/config/client @{TrustedHosts=”192.168.1.113″}

Sul CLIENT :
La configurazione è quasi la stessa
c:> winrm quickconfig
c:> winrm get winrm/config
c:> winrm set winrm/config/client/auth @{Basic=”true”}
c:> winrm set winrm/config/client @{AllowUnencrypted=”true”}
in più bisogna specificare i trusted HOST : c:> winrm set winrm/config/client @{TrustedHosts=”host1, host2, host3″}

per fare una DIAGNOSTICA di funzionamentod al CLIENT, in caso di DOMINIO bisogna utilizzare l’autenticazione KERBEROS, ovviamente dopo avere specificato sul server il TRUSTED HOST. Questo può essere un comando di diagnostica :

winrm identify -r:https://srv01.dominio.local:5985 -auth:kerberos -u:Administrator@dominio.local -p:passwd -encoding:utf-8
Se tutto va bene renderà una risposta del tipo :

IdentifyResponse
ProtocolVersion = https://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor = Microsoft Corporation
ProductVersion = OS: 6.1.7601 SP: 1.0 Stack: 2.0

Per avviare un CMD :
winrs -r:https://srv01.dominio.local:5985 -u:Administrator@dominio.local -p:passwd cmd.exe

Codici di Errore di SqlServer

0

Questi sono POSSIBILI Codici di ERRORE di SQLServer sul LOGIN :

2 e 5 – Invalid userid
6 – Attempt to use a Windows login name with SQL Authentication
7 – Login disabled and password mismatch
8 – Password mismatch
9 – Invalid password
11 e 12 – Valid login but server access failure
13 – SQL Server service paused
18 – Change password required

Merak Tool Creare ALIAS

per creare ALIAS da riga di comando su MERAK Mailserver con TOOL si può utilizzare un comando come questo:

tool create account toolusage;mio@sitoweb.eu u_password “toolpwd122”

separando il nome utente con ;

Merak : modifica (massiva) del TIPO di Casella

Per modificare la TIPOLOGIA di casella (imap, pop3, ecc.) si può intervenire direttamente sul database con questa istruzione:

UPDATE Users SET U_AccountType = ‘0’ WHERE U_Domain = ‘miosito.it’

basta Ricordare che:

AccountType = ‘0’ > pop3
AccountType = ‘2’ > imap
AccountType = ‘1’ > imap e pop3

The database principal owns a schema in the database, and cannot be dropped.

0

E’ possibile, in fase di cancellazione di un utente, imbattersi in questo errore:

Drop failed for User ‘xxxxxx’. (Microsoft.SqlServer.Smo)
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)

questo succede perchè l’utente è ancora MEMBRO di qualche Schema (nel database) e per cancellarlo bisogna prima rimuoverlo da questi schemi.
Utilizzare come SQL nel DB :

SELECT sc.name
FROM sys.schemas sc
WHERE sc.principal_id = USER_ID(‘xxxxx’)

per vedere in che schemi è l’utente. Dopodichè assegnare a DBO questi schemi in modo da “estrometterlo”

ALTER AUTHORIZATION
ON SCHEMA::db_owner
TO dbo

Unable to Relay

0

Unable to Relay è un problema di server della posta in uscita.
Lo puoi trovare in più casi
1) le impostazioni LOCALI di Outlook per il server della posta in uscita sono sbagliate (mancano user e pass per l’autenticazione)
2) le impostazioni LOCALI di Outlook per il server della posta in uscita sono “anche corrette” ma stai usando un SMTP che magari non ti fa passare (es sei connesso TIN spedisci con infostrada)
3) se è un server che ha un SMTP di inoltro….l’smtp di inoltro non ti fa passare.
Poi i casi possono essere anche altri……ma in linea di massima è un errore che ti dice che c’è qualcosa che non va in posta in uscita, non sei riconosciuto, quindi non passi!

Il set di backup include il backup di un database diverso dal database ‘xx’ esistente

0

E’ possibile, in fase di ripristino ricevere questo errore :

System.Data.SqlClient.SqlError: Il set di backup include il backup di un database diverso dal database ‘xxx’ esistente. (Microsoft.SqlServer.Smo)

questo capita perchè il Db è diverso, ma per aggirarlo è sufficiente andare in OPZIONI e utilizzare la funzione SOVRASCRIVI DATABASE ESISTENTE

 

Ripristinare un Database SQL Server da BACKUP

0

Per ripristinare un database SQL server, con Sql Studio, da un file BAK è necessario avere almeno 1 modo per far arrivare il file sul server.
Meglio se con un sistema FTP.
A quel punto possiamo utilizzare il software come mostrato in figura per caricare il file BAK
(Attenzione – i percorsi della figura sono quelli del SERVER, non del CLIENT)

come permessi per l’utente, per il momento gli ho dato : db_owner, db_denydatareader e db_backupoperator

Fusione di due Metabase.Xml (iis6 merge XML files)

0

Ci sono dei casi, nella vita, in cui IIS migration TOOL potrebbe non funzionare. I motivi possono essere molteplici, dall’errore di accesso NEGATO a errori di altra natura. In questo caso potrebbe essere necessaria una FUSIONE di due file METABASE.Xml di IIS.
Purtroppo, a differenza di quello che si crede, questa procedura non può essere fatta in modo “spavaldo” con un banale text editor Avanzato (ci ho provato) in quanto genera degli errori di vario tipo. Non può essere utilizzato nemmeno il BACKUP di IIS

Purtroppo dall’interfaccia di amministrazione le uniche operazioni che riguardano la gestione del metabase di IIS sono relative al backup ed relativo ripristino, ma fortunatamente Microsoft non ci lascia completamente a mano vuota, rendendo possibile l’operazione di esportazione e importazione tramite uno script vbs utilizzabile via shell che si chiama iiscnfg

Questo è il comando per l’esportazione, che va eseguito sul server in cui c’è la configurazione da copiare.

iiscnfg /export /f nomefile /sp / /children

Vediamo i parametri che sono stati inseriti qui:

/f indica che l’esportazione deve avvenire su file ( nel mio caso nomefile è c:backup.xml )
/sp indica il ramo del metabase, che in questo caso è un slash (che indica tutto IIS) ma potrebbe anche indicare un singolo sito
/children consente semplicemente di esportare in maniera ricorsiva tutte le sottochiavi

Prima di procedere all’importazione sul server di destinazione vi CONSIGLIO di fare un BACKUP della configurazione attuale.
Qualcosa potrebbe andare storto, potrebbero essere sovrascritti dei siti web duplicati
Ecco il comando per l’IMPORTAZIONE :

iiscnfg /import /f nomefile /sp / /dp / /children /merge

Questo SISTEMA funziona a patto che i percorsi rimangano gli stessi, ovvero se i siti prima erano sul disco D dovranno essere su D anche adesso.
Se dovete passare un server IIS5 a IIS6 procedere così:
– aggiornare WIndows 2000 a Windows 2003. Non sucecderà niente e IIS sarà aggiornato al 6.0.
– eseguire la procedura di EXPORT con iiscnfg
– EDITARE il file XML generato, più che altro per corregegre tutti i percorsi c:winnt in c:windows
– reimportare il file

XCOPY – La guida completa

Syntax
xcopy Source [Destination] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/g] [/d[:mm-dd-yyyy]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [{/a|/m}] [/n] [/o] [/x] [/exclude:file1[+[file2]][+[file3]] [{/y|/-y}] [/z]

Parameters
Source : Required. Specifies the location and names of the files you want to copy. This parameter must include either a drive or a path.
Destination : Specifies the destination of the files you want to copy. This parameter can include a drive letter and colon, a directory name, a file name, or a combination of these.
/w : Displays the following message and waits for your response before starting to copy files:
Press any key to begin copying file(s)
/p : Prompts you to confirm whether you want to create each destination file.
/c : Ignores errors.
/v : Verifies each file as it is written to the destination file to make sure that the destination files are identical to the source files.
/q : Suppresses the display of xcopy messages.
/f : Displays source and destination file names while copying.
/l : Displays a list of files that are to be copied.
/g : Creates decrypted destination files.
/d[:mm-dd-yyyy] : Copies source files changed on or after the specified date only. If you do not include a mm-dd-yyyy value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed.
/u : Copies files from Source that exist on Destination only.
/i : If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xcopy prompts you to specify whether Destination is a file or a directory.
/s : Copies directories and subdirectories, unless they are empty. If you omit /s, xcopy works within a single directory.
/e : Copies all subdirectories, even if they are empty. Use /e with the /s and /t command-line options.
/t : Copies the subdirectory structure (that is, the tree) only, not files. To copy empty directories, you must include the /e command-line option.
/k : Copies files and retains the read-only attribute on destination files if present on the source files. By default, xcopy removes the read-only attribute.
/r : Copies read-only files.
/h : Copies files with hidden and system file attributes. By default, xcopy does not copy hidden or system files.
/a : Copies only source files that have their archive file attributes set. /a does not modify the archive file attribute of the source file. For information about how to set the archive file attribute by using attrib, see Related Topics.
/m : Copies source files that have their archive file attributes set. Unlike /a, /m turns off archive file attributes in the files that are specified in the source. For information about how to set the archive file attribute by using attrib, see Related Topics.
/n : Creates copies by using the NTFS short file or directory names. /n is required when you copy files or directories from an NTFS volume to a FAT volume or when the FAT file system naming convention (that is, 8.3 characters) is required on the destination file system. The destination file system can be FAT or NTFS.
/o : Copies file ownership and discretionary access control list (DACL) information.
/x : Copies file audit settings and system access control list (SACL) information (implies /o).
/exclude:filename1[+[filename2]][+[filename3]] : Specifies a list of files containing strings.
/y : Suppresses prompting to confirm that you want to overwrite an existing destination file.
/-y : Prompts to confirm that you want to overwrite an existing destination file.
/z : Copies over a network in restartable mode.
/? : Displays help at the command prompt.

RIFERIMENTI qui

Ultime dal Nostro BLog