Condividire...

Condividere ha il suo costo, ma alla fine finisce per arricchire tutti


Sharing has its cost, but at the end leads everyone to a better knowledge

martedì 5 febbraio 2013

Gestione Hyper-V tramite Power Shell

Ottimo componente per la gestione dell' Hyper-V e della macchine virtuali tramite la Power Shell:
Codeplex

mercoledì 19 dicembre 2012

CoreConfig Security Warning

Launching: "cscript Start_CoreConfig.wsf"

You'll be asked to confirm every operation

Security Warning
Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your computer. Do you want to run C:\Utility\CoreConfig\CoreConfig.ps1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):




To solve this go to CoreConfig installation folder,edit Start_CoreConfig.wsf and substitute:



Function LaunchCoreConfig()
'========================
Dim iRetCode
Dim Temp
'
LaunchCoreConfig = False
'
On Error Resume Next
WshShell.RegWrite"HKLM\Software\Microsoft\Powershell\1\ShellIds
\Microsoft.PowerShell\ExecutionPolicy", "Unrestricted", "REG_SZ"
On Error goto 0
'
WshShell.CurrentDirectory = GlobalFolderPath
iRetCode = WshShell.Run ("C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Minimized -Sta -file CoreConfig.ps1", 1, True)
If iRetCode <> 0 Then
Call Debug("Error: During launch of CoreConfig! ReturnCode:" & iRetCode)
Call WshShell.Popup("Error: During launch of CoreConfig! ReturnCode:" & iRetCode & Vbcrlf & " Please copy source to local drive and try again!" ,0,"Error", 16)
Else
'Okay
LaunchCoreConfig = True
End If
End Function



with



Function LaunchCoreConfig()
'========================
Dim iRetCode
Dim Temp
'
LaunchCoreConfig = False
'

On Error goto 0
'
WshShell.CurrentDirectory = GlobalFolderPath
iRetCode = WshShell.Run ("%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -WindowStyle Minimized -Sta -file CoreConfig.ps1", 1, True)
If iRetCode <> 0 Then
Call Debug("Error: During launch of CoreConfig! ReturnCode:" & iRetCode)
Call WshShell.Popup("Error: During launch of CoreConfig! ReturnCode:" & iRetCode & Vbcrlf & " Please copy source to local drive and try again!" ,0,"Error", 16)
Else
'Okay
LaunchCoreConfig = True
End If
End Function




Explanation:
First of all is not a good solution to set execution policy to unrestricted for all Powershell scripts changing Reg Key:
WshShell.RegWrite"HKLM\Software\Microsoft\Powershell\1\ShellIds\Microsoft.PowerShell\ExecutionPolicy", "Unrestricted", "REG_SZ"
Second this doesn't solve the problem.
The idea is to Bypass execution policy for this script... if we trust it, of course.
I do!
Now you can enjoy your CoreConfig

lunedì 26 marzo 2012

Abilitare un alias per un Fileserver Windows 2008 R2

Problema (tipico delle operazioni di consolidamento):
abbiamo un server con nome Server1 che deve rispondere anche alle richieste con il nome Server2, quindi sia come \\Server1 che \\Server2.

Da Windows 2008 in avanti i computer oltre a supportare SMB 1.0 supportano anche SMB 2.0. SMB è il protocollo che che supporta sia lato client che lato server la "Condivisione File e stampanti".

Quindi per abilitare l'alias SERVER2 dobbiamo:
1) Creare un CNAME (Alias) nel DNS server2.miodominio.local che punti a server1.miodominio.local
2) Abilitare il supporto per l'aliasing per il protocollo SMB 1.0:
Apriamo l'Editor di Registro (regedit) ed posizioniamoci su
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters

Aggiungiamo una nuova REG_DWORD:

Nome Valore: DisableStrictNameChecking
Tipo di dati : REG_DWORD
Base : Decimale
Valore : 1
3) Facciamo un reboot del server per fargli prendere le modifiche
4) Creaiamo un Alias per l' SMB 2.0:
Apriamo un prompt dei comandi con privilegi amministrativi:
setspn -a host/server2 server1
(dove server2 è l'alias netbios e server1 è il nome netbios originale del nostro server)
setspn -a host/server2.miodomino.local server1
(dove server2.miodomino.local è il FQDN dell'alias che vogliamo creare e server1 è il nome netbios originale del nostro server)

Adesso provate ad aprire \\server2 e dovreste accedere alle condivisioni