lunedì 7 settembre 2015

Simpliest Script to share folders

Hi everybody,
for me this is the simpliest script to share folders with poweshell 4, works well in w2012:

#Username
$User = ""Write-Host $User
$DomainUser = "pacorini\"+$User


#User home folder base path
$BasePath = 'E:\HomeFolders\'




#Select the name of the share$ShareName=$User
#Combine sharebase folder and user to construct the full path
$ShareFolder = $BasePath+$User



#Create new share - this work only with windows 2012

New-SmbShare -Name $Sharename -Path $ShareFolder -FullAccess $User


#Alternatively you could use this (on previous version):
#$Shares=[WMICLASS]'WIN32_Share'
#$Shares.Create($ShareFolder,$ShareName,0)



#Set NTFS Permission

$Acl = Get-Acl $ShareFolder

$Ar = New-Object system.security.accesscontrol.filesystemaccessrule($DomainUser,'FullControl','ContainerInherit, ObjectInherit', 'None', 'Allow')

$Acl.AddAccessRule($Ar)

Set-Acl $ShareFolder $Acl



#Set Smb share permission.
Revoke-SmbShareAccess -Name $ShareName -AccountName "Everyone" -Force
Grant-SmbShareAccess -Name $ShareName -AccountName $DomainUser -AccessRight Full -Force




If you like this post, please leave a comment.

venerdì 21 agosto 2015

Windows Print server Migration, how to migrate without user action.

Often is needed to migrate printer services from one server to another, nowadays server changes from x86 to 64 bit version so the use of prtinter migration tools could not be applied everytime, least but not las I prefer to do it manually to have full control of migration steps and to avoid user implication.
So this is the steps that i usually use.

First of all take a list of the printers that have to be migrated, sometimes happens that old queues are not deleted.
Control the printer ip port, sharename and driver type name and version used.

Create the new server and be sure to install printer add ons.


Create TCP/IP printer ports via script on new server:
Then open a terminal console with administrative rights and go to the folder: 
windows 2003: c:\windows\system32
windows 2008/2012C:\Windows\System32\Printing_Admin_Scripts\en-US

cscript prnport.vbs -a -r IP_ -h -o raw -n 9100

I suggest to create a little batch file or just use notepad++ to create as mutch rows as needed and then paste in console window.


Then create the new printers with printmanament.msc using administrator rights. Be sure to use the same sharename as old server. 
This operation should be also automated in various way, but this will be another story.

Then you have just to change on clients the registry key:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Port

For example I have this local port:

\\spoolsrv\hp4014

In the registry I have a REG_SZ key with that name, it is enough to change it and restart spooler service.


If this post was youseful to you please leve a message.
Mik

giovedì 11 giugno 2015

OAB Generation troubleshooting

Very good article on OAB generation troubleshooting.
http://unified.swiatelski.com/2011/02/exchange-2010-cannot-download-offline.html

lunedì 4 maggio 2015

Sendmail via script

Consiglio questa ottima applicazione per inviare mail, utile per scripting in caso di necessità di inviare file di log.

E' in grado di utilizzare smtp autenticato e di inserire il contenuto di un file nel corpo della mail :)

http://caspian.dotconf.net/menu/Software/SendEmail/

venerdì 10 aprile 2015

Windows Lite Touch installation test su Virtualbox 4.3.12

Se l'errore che si presenta è questo:


Your PC needs to restart.
Please hold down the power button.
Error code: 0x000000C4
Parameters:
0x0000000000000091
0x000000000000000F
0xFFFFF801E5962A80
0x0000000000000000


Rilevare il nome della VM con 
"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list vms

Procedere come segue da una finestra dos sostituendo vname con il nome della vm ottenuto dal p.to precedente racchiuso tra apici
"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" setextradata [vmname] VBoxInternal/CPUM/CMPXCHG16B 1

venerdì 3 aprile 2015

Sulla vicenda dell'America's Cup

E' notizia di questi giorni che il defender dell'Americas Cup, Teamo Oracle e altri tre challenger hanno votato per cambiare le regole di stazza della 35a coppa per ridurre i costi, al di là della notizia e delle motivazioni, ciò che mi è piaciuto e che sento sia il caso di riportare qui è uno stralcio della dichiarazione di Patrizio Bertelli fondatore del team:

“In sports, as in life, one cannot always go for compromise, after compromise, after compromise,” states team owner Patrizio Bertelli. “Sometimes it is necessary to make decisions that are painful but must be clear cut, as only these can make everybody aware of the drifts of the system and therefore set the basis for the future: respect of legality and sportsmanship”

La notizia completa è visibile qui: http://www.sailingscuttlebutt.com/2015/03/31/new-americas-cup-class-approved/?utm_medium=email&utm_campaign=Scuttlebutt+4303+-+April+3+2015&utm_content=Scuttlebutt+4303+-+April+3+2015+CID_59089a79f6927b2b542626f703f3d2ae&utm_source=Email%20Newsletter&utm_term=smaller%20and%20more%20affordable%20boat

mercoledì 11 marzo 2015

Disable Internet Explorer Java ActiveX check

Per permettere l'esecuzione di versioni java obsolete che sono compatibili con applicazioni di terze parti come Unicredit banking eseguire i seguenti passi:

reg add "HKCU\Software\Microsoft\Internet Explorer\VersionManager" /v DownloadVersionList /t REG_DWORD /d 0 /f

del “%LOCALAPPDATA%\Microsoft\Internet Explorer\VersionManager\versionlist.xml”
 
 
Il secondo passaggio conviene farlo partendo da “%LOCALAPPDATA%
 
Altri workaround
http://blogs.msdn.com/b/ie/archive/2014/08/06/internet-explorer-begins-blocking-out-of-date-activex-controls.aspx