Monday, May 17, 2021

Powershell and Visual Basic logon scripts to map drives

On Error Resume Next 
' Ref: https://community.spiceworks.com/topic/1945685-gpo-drive-mapping-not-mapped-on-login-but-mapped-on-gpupdate
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUserDN)
Set objNetwork = CreateObject("Wscript.Network")
Set objShell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")

'Map network share by group
arrGroups = objUser.GetEx("memberOf")
   For Each strGroup in arrGroups
        Set objGroup = GetObject("LDAP://" & strGroup)
        strGroupName = objGroup.CN

        Select Case strGroupName
 
        Case "N_share"
            objNetwork.MapNetworkDrive "Z:", "\\server\Network_share"

        'Case "Teachers"
            'objNetwork.MapNetworkDrive "K:", "\\fileserver\teachers$"

        End Select
Next



'Label the Network drives
Set WshNet = WScript.CreateObject("WScript.Network")
 Set oShell = CreateObject("Shell.Application")
 
Set nDrives = WshNet.EnumNetworkDrives
 
For i = 0 To nDrives.Count - 1 step 2
 path = nDrives.Item(i+1)
 drive = ndrives.Item(i)
 if drive <> "" then
 folders = Split(path,"\")
 foldername = folders(ubound(folders))
 oShell.NameSpace(drive & "\").Self.Name = foldername
 end if
 next
 
Set WshNet = Nothing
 Set oDrives = Nothing
 Set oShell = Nothing

Enable RDP, Ping, File sharing, remote registry and allow it through firewall from cmd line

REM
REM ENABLE RDP
REM
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
netsh advfirewall firewall set rule group="remote desktop" new enable=yes
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-TCP" /v UserAuthentication /t REG_DWORD /d "0" /f  
REM
REM SET REMOTEREGISTRY SERVICE TO AUTO START AND START IT
REM
sc config remoteregistry start=auto
wmic service where "name = 'remoteregistry'" call startservice

REM install Telnet client dism /online /Enable-Feature /FeatureName:TelnetClient REM
REM
REM ENABLE FIREWALL
REM
netsh Advfirewall set allprofiles state on

REM
REM ENABLE FILE SHARING
REM
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes

REM
REM ENABLE ICMP PING REPLY
REM
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
REM Disable 'Fast Boot'
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f

Wednesday, May 12, 2021

Tuesday, May 11, 2021

Henry's Post Tester

Henry's Post Tester is a service for developers testing clients that POST and GET things over HTTP. 

http://ptsv2.com/

 

 


Use textverified.com to receive text messages

Great for expats.  Allows you to temporarily rent a US phone number -- an actual one, not a VoIP one, so you can receive sms - a txt message...