2011/01/06
Active Directory - Delegate Remote Access Permission
ADUC.
ManageDialin
Note: this model requires editing the C:\windows\system32\DSSEC.DAT
file on the DC that you are running ADUC on. See
http://support.microsoft.com/?id=296490 for more details. In short,
some of the rights that need to be delegated are filtered out from the
list by default. Edit the file so that these permissions are no longer
filtered (set them from 7 to a 0):
1. Set the following values to 0 under the [user] area in the file (not
under [computer]):
" msNPAllowDialin=0
msNPCallingStationID=0
msNPSavedCallingStationID=0
msRADIUSCallbackNumber=0
msRADIUSFramedIPAddress=0
msRADIUSFramedRoute=0
msRADIUSServiceType=0
msRASSavedCallbackNumber=0
msRASSavedFramedIPAddress=0
msRASSavedFramedRoute=0"
2. Save the file and then open ADUC / run delegation wizard etc as
outlined below.
3. Specify the group to delegate to (DELG Group)
4. Select Create a custom task to delegate and select Next
5. Select Only the following objects in the folder
a. User objects
6. Select Next
7. Select General and Property-specific under Show these permissions
8. Select "Read and Write Remote Access Information"
9. Select the Read and Write checkboxes for all of the following
attributes
" msNPAllowDialin
msNPCallingStationID
msNPSavedCallingStationID
msRADIUSCallbackNumber
msRADIUSFramedIPAddress
msRADIUSFramedRoute
msRADIUSServiceType
msRASSavedCallbackNumber
msRASSavedFramedIPAddress
msRASSavedFramedRoute
userParameters"
10. Select Next
11. Review Summary and Select Finish to complete
2010/12/23
Powershell - Using String Functions
Source: http://powershell.com/cs/blogs/tips/archive/2009/06/08/using-string-functions.aspx
PowerShell uses .NET objects everywhere. Anything is represented as .NET object, and .NET objects come with useful built-in methods. However, for string manipulation you do not need to look for sophisticated external commands as they are built right into strings.
Here are a couple of useful examples:
"Hello".ToUpper()
"Hello".EndsWith('lo')
"Hello".StartsWith('he')
"Hello".toLower().StartsWith('he')
"Hello".Contains('l')
"Hello".LastIndexOf('l')
"Hello".IndexOf('l')
"Hello".Substring(3)
"Hello".Substring(3,1)
"Hello".Insert(3, "INSERTED")
"Hello".Length
"Hello".Replace('l', 'x')
"Server1,Server2,Server3".Split(',')
" remove space at ends ".Trim()
" remove space at ends ".Trim(' rem')
Rename a network card in Command Line
Last week i was working on HP RDP (Rapid Deployment Pack), we want to automate the deployment of new server (Mainly Physical, and some Virtual)
I was looking for a way to rename an network Interface, by default: "Local Area Connection" or "Local Area Connection 2". Here is the useful command:
netsh interface set interface name="Local Area Connection" newname="ExampleLan"
2010/12/21
MS Windows Server 2008 R2 - Desktop Icons
First, you'll have to go into Server Manager and access the Features section. In Features, you will select to add a feature and then select the Desktop Experience feature. Once added, you will have to reboot the server. That's right! A reboot is required to add icons to your desktop.
Now this is really insane. Think about it. You can add your own icons for shortcuts on the desktop, but to get Computer and Network, you have to add the entire Desktop Experience feature. What a ridiculous decision Microsoft made here.
Now that I've expressed my suffering, we shall move on.
Once you've rebooted the server, simply right-click on the Desktop and select Personalize. From here, you can add the desktop icons you desire as usual.
OK. I'm over it now, but it's still ridiculous.
2010/11/24
BlackBerry and Powershell
Requirements:
1. Install Quest Powershell Cmdlets "http://www.quest.com/powershell/activeroles-server.aspx" and make sure the snapin is loaded in powershell. I usually load it in my profile.ps1 file.
2. To use the new functions you need to follow the following install instructions. Install these components in the following order from this web site "http://www.microsoft.com/downloads/details.aspx?FamilyId=228DE03F-3B5A-428A-923F-58A033D316E1&displaylang=en" <This allows you to take advantage of the SQL 2008 cmdlets from Microsoft>
• Microsoft SQL Server System CLR Types
• Microsoft Core XML Services (MSXML) 6.0 (Note: This component is already part of SQL Server 2005, it will likely not need to be installed. I provide it here for completeness of prerequisites).
• Microsoft SQL Server 2008 Native Client (Note: I only installed the client. I did not install the SDK as well.)
Microsoft SQL Server 2008 Management Objects
• Microsoft Windows PowerShell Extensions for SQL Server
Run this from powershell.
set-alias installutil $env:windir\microsoft.net\framework\v2.0.50727\ins tallutil
installutil -i "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.M anagement.PSProvider.dll"
installutil -i "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.M anagement.PSSnapins.dll"
Usuage : gbesuser "samaccountname"
function gbesuser ($user){
function devicetype ($type){
switch ($type){
"3"{"GSM"}
"4"{"CDMA"}
default{"Unknown"}
}
}
function vendor($vendorID){
switch ($buser.VendorID){
"102"{"Cingular"}
"103"{"NEXTEL"}
"104"{"SprintPCS"}
"105"{"Verizon"}
"107"{"Rogers"}
"109"{"Bell Mobility"}
"120"{"Vodafone-UK"}
"126"{"TELUS"}
"138"{"Vodafone-AU"}
"220"{"NNT DoCoMo"}
default{"Unknown"}
}
}
$server=""
$database = ""
$mdn = get-Qaduser $user -includeallproperties | select legacyExchangeDN,AccountIsDisabled
$bsql1 = "Select UserConfig.DisplayName,MachineName,PIN,DeviceType,ModelName,PhoneNumber,AppsVer`
,VendorID,IMEI,ICCID,MsgsForwarded,MsgsSent,MsgsPending,MsgsExpired,MsgsFiltered,MsgsFailed`
,Status,LastFwdTime,LastSentTime from UserConfig,SyncDeviceMgmtSummary`
,UserStats,ServerConfig where UserConfig.ID=SyncDeviceMgmtSummary.UserConfigID `
and UserConfig.ID=UserStats.UserConfigID and UserConfig.MailboxDN = '"+$mdn.legacyexchangedn+"' `
and Serverconfig.ID=UserConfig.ServerConfigID"
$buser = Invoke-Sqlcmd -query $bsql1 -serverinstance $server -database $database
$buser | select displayname,machinename,pin,@{Name="DeviceType";expression={devicetype $buser.devicetype}}`
,modelname,phonenumber,appsver,@{name="VendorID";expression={vendor $buser.vendorID}}`
,imei,iccid,MsgsForwarded,msgssent,msgspending,msgsexpired,msgsfiltered,msgsfailed,status,lastfwdtime,`
lastsenttime,@{name="AccountStatus";expression={if($mdn.accountisdisabled -eq $true){"Disabled Account"}else{"Normal Account"}}}
}
Expected Output: (I replaced company internal information with astericks)
2010/11/23
Zenmap (Nmap Gui)–Network Scanner
Zenmap is the official Nmap Security Scanner GUI. It is a multi-platform (Linux, Windows, Mac OS X, BSD, etc.) free and open source application which aims to make Nmap easy for beginners to use while providing advanced features for experienced Nmap users. Frequently used scans can be saved as profiles to make them easy to run repeatedly. A command creator allows interactive creation of Nmap command lines. Scan results can be saved and viewed later. Saved scan results can be compared with one another to see how they differ. The results of recent scans are stored in a searchable database.
You can download Zenmap (often packaged with Nmap itself) from the Nmap download page. Zenmap is quite intuitive, but you can learn more about using it from the Zenmap User's Guide or check out the Zenmap man page for some quick reference information.
Here are some Zenmap action shots (click for full res):
2010/11/16
Inventory - SYDI - Commands
cscript sydi-server.vbs –t<NOM_DU_SERVER>
#SYDI XML
cscript sydi-server.vbs –t<NOM_DU_SERVER> -o<NOM_DU_SERVER>.xml -ex
#XML TO DOC (Need MS Word on the machine)
cscript.exe ss-xml2word.vbs -x<NOM_DU_SERVER>.xml -llang_english.xml
#XLS – OVERVIEW (with XML Files)
cscript.exe sydi-overview.vbs -x<PATH>
#XML TO HTML (Need MS Excel on the machine)
cscript.exe sydi-transform.vbs -x<SERVERNAME>.xml -sServerhtml.xsl -o<SERVERNAME>.html
2010/09/27
Active Directory - Saved Queries (ADUC MMC)
All queries located in the Saved Queries folder are stored in Active Directory Users and Computers (dsa.msc). Once you have successfully created your customized set of queries you can copy the .msc file to other domain controllers (located in the same domain) and use the same set of saved queries. You can also export saved queries to an .xml file and import them into other Active Directory User and Computer consoles located on domain controllers (within the same domain)
LDAP Syntax