Quantcast
Channel: Powershell – Jacques Dalbera's IT world
Viewing all 85 articles
Browse latest View live

Windows forensic: Sysmon

$
0
0

Download sysmon:

NEW: Sysmon 6.0 is available ! : https://technet.microsoft.com/en-us/sysinternals/sysmon  and how to use it:

Installation and usage:

List of web resources concerning Sysmon: https://github.com/MHaggis/sysmon-dfir

Mark russinovitch’s RSA conference: https://onedrive.live.com/view.aspx?resid=D026B4699190F1E6!2843&ithint=file%2cpptx&app=PowerPoint&authkey=!AMvCRTKB_V1J5ow

Sysmon config files explained:

https://github.com/SwiftOnSecurity/sysmon-config

https://github.com/ion-storm/sysmon-config/blob/master/sysmonconfig-export.xml

https://www.bsk-consulting.de/2015/02/04/sysmon-example-config-xml/

View story at Medium.com

Else other install guides:

http://www.darkoperator.com/blog/2014/8/8/sysinternals-sysmon

 

Detecting APT with Sysmon:

https://www.rsaconference.com/writable/presentations/file_upload/hta-w05-tracking_hackers_on_your_network_with_sysinternals_sysmon.pdf

 

https://www.root9b.com/sites/default/files/whitepapers/R9B_blog_005_whitepaper_01.pdf

Sysmon with Splunk:

http://blogs.splunk.com/2014/11/24/monitoring-network-traffic-with-sysmon-and-splunk/

https://securitylogs.org/tag/sysmon/

Sysmon log analyzer/parsing sysmon event log:

https://github.com/CrowdStrike/Forensics/blob/master/sysmon_parse.cmd

https://digital-forensics.sans.org/blog/2014/08/12/sysmon-in-malware-analysis-lab

https://github.com/JamesHabben/sysmon-queries

http://blog.crowdstrike.com/sysmon-2/

logparser: http://www.microsoft.com/en-us/download/confirmation.aspx?id=24659

logparser GUI: http://lizard-labs.com/log_parser_lizard.aspx



AD – Securing Domain Controllers / hardening Windows domain and computers

$
0
0

Some interesting sites:

Reference articles to secure a Windows domain:

https://github.com/PaulSec/awesome-windows-domain-hardening

Microsoft audit Policy settings and recommendations:

https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/plan/security-best-practices/audit-policy-recommendations

Sysinternals sysmon:

https://onedrive.live.com/view.aspx?resid=D026B4699190F1E6!2843&ithint=file%2cpptx&app=PowerPoint&authkey=!AMvCRTKB_V1J5ow

On ADsecurity.org:

Beyond domain admins: https://adsecurity.org/?p=3700

Gathering AD data with PowerShell: https://adsecurity.org/?p=3719

Hardening Windows computers, secure Baseline check list: https://adsecurity.org/?p=3299

Hardening Windows domain, secure Baseline check list:

 


Free Tools for System and Network or DB Administrators

$
0
0

Free tools for Windows sysadmins:

– Registry editor and comparison, replace: regedt33.exe: https://sourceforge.net/projects/regedt33

– AD security: adsecurity.org  ; http://www.dsinternals.com ; http://www.pingcastle.com; https://thycotic.com/solutions/free-it-tools/weak-password-finder/

– Powershell windows forensics: https://github.com/Invoke-IR/PowerForensics  and  https://github.com/gfoss/PSRecon and https://github.com/davehull/Kans

– Memory forensics: http://www.volatilityfoundation.org/

– Crowdstrike free tools: http://www.crowdstrike.com/community-tools/index.html

– McAfee foundstone free tools: http://www.mcafee.com/us/downloads/free-tools/index.aspx

– Trousse de secours Windows sur cle USB: http://wp.me/p15Zft-wU

– Net tools and forensic tools for windows : http://www.nirsoft.net/utils/ipnetinfo.html
– System and performance: CCleaner,recuva,defragler,speccy from pirisoft: https://www.piriform.com/products
– Windows 8 or Server  2012 start menu (GUI): http://www.classicshell.net/
– New Microsoft network monitor called MESSAGE ANALYZER (GUI): http://www.microsoft.com/en-us/download/details.aspx?id=40308
– ESET Sysinspector: http://www.eset.com/us/download/utilities/ (is a convenient utility for the tool box of every IT expert and first responder)
– Qualys browsercheck: https://browsercheck.qualys.com/  (check internet browser vulnerabilities)
– Secunia personal inspector: http://secunia.com/vulnerability_scanning/personal/download_psi/ (scanner application’s vulnerabilities)
– TrueCrypt. Is disk encryption software: http://www.truecrypt.org/
– Keepass. To remember passwords: http://keepass.info/
– Putty, FileZilla, WinSCP, XMing (free Xserver), MobaXterm (free Xserver and SSH): Unix tools for Windows
– Remote Desktop managers: mRemoteNG, Remote Desktop manager
– Ophcrack is a free Windows password cracker based on rainbow tables: http://ophcrack.sourceforge.net/
– Anti-malware free Malwarebytes (GUI): http://www.malwarebytes.org/
– Inventory tool that performs hardware scanning, software scanning, and Active Directory (AD) reporting (GUI):  www.lansweeper.com
– DNSdataview (GUI): www.nirsoft.net/utils/dns_records_viewer.html
– WinDirStat (GUI): http://windirstat.info
– Archiving and compression 7-zip  (GUI): www.7-zip.com
– Compare content files: ExamDiff  (GUI):  www.prestosoft.com/edp_examdiff.asp
– File Recovery (GUI): PC inspector File recovery   and    easeUS data recovery
– System Information for Windows and benchmarks (Gathers detailed information about a computer’s system properties, settings, and displays, benchmarks):
        – SIW  (GUI)
        – AIDA  (GUI)
        – Everest  (GUI):
– HDTune: GUI – simple disk IO utility
– Unlock DLL: GUI to unlock DLLs in use (c.f unlocker utility on internet)
– AD queries builder with powershell and powershell editor  (GUI): http://www.powergui.org
– AD reports and ldap builder (GUI): http://www.maxpowersoft.com/
– AD change reporter (GUI): www.tinyurl.com/cph99tu
– AD object restore wizard (GUI): www.tinyurl.com/kv83sh9
– Inactive users tracker (GUI): www.tinyurl.com/xv83dsf
– Netmork Monitoring (GUI): http://www.spiceworks.com/, or quest scriptlogic free utility called sl360
– Disk space monitor (GUI): www.tinyurl.com/zksfuw
– Bulk password reset (GUI): www.tinyurl.com/cxc3t4d
– Windows service monitor (GUI): www.tinyurl.com/dakjw32
– Vmware change reporter (GUI): www.tinyurl.com/dsdz44
– File server change reporter (GUI): www.tinyurl.com/bhd3k2b
– Password expiration notifier (GUI): www.tinyurl.com/kbwu34z
– USB blocker (GUI): www.tinyurl.com/awqc4p3
– Free disk analysis tool (Gui): www.northern-utilities.com  ; Find out how much of your storage capacity is being wasted on unwanted files
– Netbook Hardware control (GUI): www.pbus-167.com
– Sysinternal Tools (CMD/GUI): www.microsoft.com/sysinternals
 – www.joeware.net (CMD)
www.netikus.com (CMD/GUI)
www.solarwinds.com
– OpenSSH (Gui, Cmd: www.openssh.com )
– OpenVPN (GUI, Cmd: http://openvpn.net )
– Microsoft Security Essentials: Antivirus/Anti-malware free: www.microsoft.com/security_essentials
– Microsoft Resource Kits
– ClamAV: Antivirus
– AVast: Antivirus
– Free download manager: IE download manager
– Daemontools or Virtual Clone Drive (GUI)
– Tree size free: Directory or disk usage and statistics (GUI): http://www.jam-software.com/freeware/
– CDex: transform CD in MP3… (GUI)
– Desktop Restore. Records the position of desktop icons and restores desktop layouts.
– InfraRecorder. Burns ISO images and creates data and audio CDs and DVDs: http://infrarecorder.org/
– Notepad++. Is a text and code editor.
– NTFS Undelete. Recovers deleted files that are no longer in the recycle bin.
– Paint.NET. Manipulates images.
– PING. Makes a sector-based image copy of a disk partition.
-Windows Preinstallation Environment (WinPE). Lets you make a Windows command-line boot recovery DVD.
– XML Notepad. Is a specialized XML editor.
– ZoomIt. Magnifies portions of a screen and lets you draw on and annotate the screen (c.f www.microsoft.com/sysinternals).
– BareTail. Monitors log files in real time.
– Wireshark. Is a protocol analyzer: http://www.wireshark.org
– FileZilla. Is a GUI FTP client.
– Winscp. Is a GUI sftp client.
– Ngrep. Is a packet sniffer based on finding matching text strings.
– NeWT. Is a vulnerability scanner. (If you’re interested in obtaining this software after reading about it, go to http://cgi.tenablesecurity.com/tenable/requestForm.php.)
– OpenSSH. Creates secure, encrypted shell sessions.
– WinDump. Is a command-line packet sniffer. (If you’re interested in obtaining this software after reading about it, go to http://www.winpcap.org/windump/default.htm.)
– Winfingerprint. Is a network scanner.
– LocatePC. Emails you whenever any private or public IP address in your system changes.
– Open Computers and Software Inventory (OCS Inventory NG). Provides detailed inventory data for an entire network of computers as well as deploys packages. (If you’re interested in obtaining this software after reading about it, go to http://sourceforge.net/projects/ocsinventory.)
– PRTG Traffic Grapher. Is a network monitor.
– SyncBack. Backs up or synchronizes files to another location: http://www.2brightsparks.com/freeware/freeware-hub.html
– Wink. Builds screencast recordings. (The write-up for this tool isn’t in the main article but rather its sidebar “Screencasting with Wink”. If you’re interested in obtaining this software after reading about it, go to http://www.debugmode.com/wink.)
– CamStudio. Builds screencast recordings.
– CDBurnerXP. Burns CD-ROMs, DVDs, audio CDs, and ISO images.
– Comodo Firewall Pro. Is a firewall and antivirus application.
– DriveImage XML. Is a program for imaging and backing up partitions and logical drives.
– GParted LiveCD. Manages partitions on systems. (You can also find information about GParted in “Tool Time: Repartition Windows Servers with GParted”.)
– PageDefrag. Determines how fragmented your paging files and registry hives are, and defragments them (c.f www.microsoft.com/sysinternals)
– JkDefrag. Defragments and optimizes disks.
– TestDisk. Recovers damaged partitions, makes non-bootable disks bootable again, and repairs damaged boot sectors.

Free Virtualization tools:

– Free Tools for hyperV: http://social.technet.microsoft.com/wiki/contents/articles/2325.hyper-v-top-free-programs.aspx

-If you work with virtual machines (VMs), check out the following 29 tools:
“Virtualization on the Cheap”
1. Catbird Compliance Enforcer. Analyzes existing virtual infrastructures, then highlights rogue VMs, quarantines suspect VMs, and generates compliance and security reports.
2. Citrix XenServer. Is a virtualization platform.
3. ConfigCheck. Evaluates an ESX Server installation to see whether it’s configured properly and in accordance with VMware’s best practices, particularly with regard to security guidelines.
4. EasyVMX. Lets you create web-based VMs.
5. Hyper-V. Is a virtualization platform.
6. Microsoft Assessment and Planning Toolkit. Searches out computers in a network, then generates a detailed inventory using Windows Management Instrumentation (WMI), SNMP, or Remote Registry Service.
7. Microsoft Virtual PC 2007. Is a virtualization platform.
8. OpsCheck. Troubleshoots configuration problems that might cause VMware VMotion to encounter problems.
9. PlateSpin Recon Inventory Edition. Profiles and analyzes data centers, then gathers information about traffic, workload, asset inventory, and application services.
10. Veeam Monitor Free Edition. Monitors VMware ESX and ESXi environments in real-time.
11. Virtual Iron Single Server Edition. Is a virtualization platform.
12. VirtualBox. Is a virtualization platform.
13. Vizioncore vOptimizer FreeWare. Squeezes Microsoft and VMware VMs into more manageable sizes.
14. VMware ESXi. Is a virtualization platform.
15. VMware Player. Loads and run VMs created by other virtualization products.
16. V-Scout. Aggregates and organizes information from up to two VMware VirtualCenter installations.
“More Free Virtualization Tools”
17. PHD Virtual.com website. Offers several free VMware utilities (e.g., VMNetBac, SnapHunter).
18. VM Explorer (VMX). Powers VMs on or off as well as backs up and restores VMs.
19. Xtravirt.com website. Offers several free virtualization utilities (e.g., GetVMwareDocs, Visio Action Pack).
“Free Virtualization Utilities”
20. ISO Recorder. Creates and burns ISO images.
21. Ultimate-P2V. Converts physical systems to VMs.
22. VHD Resizer. Expands and shrinks .vhd files.
23. VHDMount. Mounts a .vhd file as a local drive.
24. Virtual Floppy Drive. Mounts a virtual floppy drive from a VM.
25. Virtual Machine Remote Control Client Plus (VMRCplus). Manages, configures, and connects to Microsoft VMs.
26. VMDK to VHD Converter. Converts VMware images to Microsoft images.
27. VMmark. Benchmarks applications running in VMware VMs.
28. VMware Converter. Converts physical machines or Microsoft VMs to VMware VMs.
29. VMware Workstation 5.5 Disk Mount Utility. Mounts a VMware.vhd file on a Windows host.
Note that you can find more information about Hyper-V, VMware ESXi, and Citrix XenServer in “Free Hypervisors Extend Your IT Resources”.

Free Scripting tools:

No matter whether you write scripts or not, you’ll likely find many of the 14 tecommendations in “Script Writers’ Favorite Free Utilities” helpful:
1. Blat. A command-line utility that uses SMTP to send email or uses Network News Transfer Protocol (NNTP) to post to Usenet.
2. AutoIt v3 and SciTE Is a scripting language (AutoIt) and editor (SciTE).
3. CodeKeep Add-In. Is a code snippet manager for Visual Studio (VS).
4. DumpSec. Is a Windows security auditing program.
5. Joeware website. Offers many command-line utilities to automate AD tasks (e.g., AdQueueLoop, Unlock) and other tasks (e.g., DNSSrvRec, SidToName).
6. MD5WIN. Computes and compares Message-Digest algorithm 5 (MD5) digest strings.
7. NirSoft website. Offers numerous utilities for monitoring networks, managing passwords, retrieving Internet-related data, and performing other system-management tasks.
8. Notepad++. Is a text and code editor.
9. PSPad. Is a text and code editor.
10. Python. Is a programming/scripting language that you can use to automate tasks.
11. Regular Expression Laboratory. Lets you create regular expressions and test them against arbitrary text.
12. VIM. Is a text and code editor.
13. WinZip Command Line Support Add-On. Lets you use WinZip directly from the command line and from scripts.
14. Powershell editor and Gui powershell code builder: http://www.powergui.org
check also the powerpacks (like plug-ins for powergui, to manage other windows applications).

Free tools for Sharepoint:

Freebies that might be of interest to SharePoint administrators include the following:
“SharePoint Freebies Someone You Might Know Might Want”
1. Document Connection for Mac. Aids in accessing and browsing Mac documents in SharePoint.
2. Free Technology for Microsoft SharePoint User Groups. Is a program to provide free add-ons and other products to community-organized SharePoint user groups.
3. Persian Language Pack for Windows SharePoint Services (WSS) 3.0.
“More SharePoint Freebies Someone You Might Know Might Want”
4. Discovery Wizard for SharePoint. Gathers SharePoint inventory data and displays it in HTML reports.
5. DocAve SQL Restore Controller. Provides item-level, site-level, and site collection-level restores from active SQL Server databases and from SQL Server backups.
6. Idera SharePoint performance monitor. Monitors SharePoint performance counters and sends email alerts when problems arise.
“Free SharePoint Archiving Tool Aims to Cut Bloat”
7. Metalogix Archiving Express for SharePoint. Archives SharePoint content.

Free tools for Exchange:

Some helpful freebies when working with Microsoft Exchange include:
“Top 10 Exchange Server 2007 Troubleshooting Tools”
1. Database Recovery Management Tool. Analyzes a database store and specifies the steps needed to mount it.
2. Database Troubleshooter. Analyzes database and transaction logs and their entries and reports on problems that might prevent you from recovering the database.
3. Dcdiag. Analyzes the state of domain controllers in a forest or enterprise and reports any problems.
4. Event Viewer. Lets you view Exchange-related events.
5. Mail Flow Troubleshooter. Identifies and repairs mail flow holdups.
6. Message Tracking. Reveals a message’s path through the Exchange Server organization when messages get lost in mail flow transit.
7. Nslookup. Helps troubleshoot DNS problems.
8. Performance Monitor. Analyzes counters associated with various aspects of system performance to see whether those counters fall within a designated range.
9. Performance Troubleshooter. Analyzes three RPC performance problems.
10. Queue Viewer. Lets you view and interact with mail flow queues.
“Two Exchange Server Tools You Should Know About”
11. Performance Analysis of Logs (PAL). Analyzes a performance monitor counter log analyzes and puts its findings in an HTML report.
12. ‘Rough and Tough’ Guide to Identifying Patterns in Transaction Logs. Provides a set of tools and associated processes for figuring out what’s happening on an Exchange server given a set of transaction log files.

Free tools for SQL Server:

If your IT duties include working with SQL Server, check out “The Mega Guide to Free SQL Server Tools”. This guide includes 80 tools, so the list is too long to print here. You can find out what those tools are at http://www.sqlmag.com/Articles/ArticleID/102244/102244.html.
At SQL Server Magazine, we’re all about helping DBAs and developers do their jobs faster and more efficiently—especially now, when they’re being expected to do more with less staff and funding. That’s why, when we realized just how many free SQL Server tools are available, we decided to bring them to your attention. You might recognize some of these tools from Kevin Kline’s Tool Time or Michael Otey’s Back Page, and many of these tools can be found on Microsoft’s CodePlex website. These tools were created by in-the-trenches DBAs and developers, as well as third-party SQL Server product vendors, to solve specific SQL Server problems or to fill holes in SQL Server’s functionality. There are so many free SQL Server tools that we couldn’t test them all, so be sure to test them yourself before running them in production.
Administration
• Data Scripter Add-in for Management Studio—This add-in lets you script data for SQL Server tables through SQL Server Management Studio (SSMS) (sqlblogcasts.com/blogs/seanprice/archive/2007/08/28/data-scripter-add-in-for-management-studio.aspx)
• Iometer—This tool measures and characterizes I/O subsystems in single and clustered servers (www.iometer.org)
• Microsoft SQL Server 2005 Upgrade Advisor—This tool analyzes your SQL Server 2000 and SQL Server 7.0 instances to find features and configuration changes that could affect an upgrade to SQL Server 2005 (www.microsoft.com/downloads/details.aspx?FamilyID=1470e86b-7e05-4322-a677-95ab44f12d75)
• mRemote—You can use this tool (which supports both RDP and VNC) to manage your remote server connections from a central GUI (www.mremote.org/wiki)
• MSSQL Blocks—This tool collects information from multiple SQL Server 2005 and 2000 instances about locked or blocked processes and stores this information in XML files for later analysis (sqlblocks.narod.ru)
• Orphan Finder—You can use Orphan Finder to find records in your SQL Server 2005 databases in which there are values in a foreign key column that aren’t in the parent table (http://www.spi.hr/EnglishaboutLC/tabid/470/Default.aspx)
• Partition Management—This tool uses the Sliding Window technique to remove data from one partition and place it into a staging table, and creates a staging table that’s used to load data into partitions (www.codeplex.com/SQLPartitionMgmt)
• Quest Software’s Toad for SQL Server Freeware—Toad for SQL Server Freeware offers a code and data editor, a data grid for modifying tables, and a database browser that lets you view and manage database objects graphically (www.toadsoft.com/toadsqlserver/toad_sqlserver.htm)
• SortSQLFilesInProject—You can use this tool to sort the SQL files contained in an SSMS project or the packages in a SQL Server Integration Services (SSIS) project (www.sqldbatips.com/showarticle.asp?ID=78)
• SQLDBSize 1.0—This tool graphically displays size information about your databases, tables, indexes, and more (www.sqldbtools.com/Tools.aspx?ProductId=3)
• SQL Management Studio Snapshot Add-In—This utility adds the Create Snapshot option to context menus in SSMS, enabling you to create a database snapshot (sqlblogcasts.com/blogs/seanprice/archive/2007/07/15/sql-management-studio-snapshot-add-in.aspx)
• SQLRecon—SQLRecon finds all of your SQL Server and Microsoft SQL Server Desktop Engine (MSDE) systems by performing active and passive scans on your network (www.specialopssecurity.com/labs/sqlrecon)
• SQL Server 2008 Extended Events Manager—This tool lets you create, delete, modify, start, and stop Extended Events sessions and metadata files in SQL Server 2008 (www.codeplex.com/ExtendedEventManager)
• SQL Server Automation Scripts—This tool provides SQL Server Agent jobs that you can use to perform automated maintenance tasks (download.microsoft.com/download/4/0/C/40CBAD9A-D990-450B-8785-F288CEBFB448/AITScripts.zip)
• SQL Server Database Copy Tool—With this utility, you can copy databases from one SQL Server system to another (dbcopytool.codeplex.com)
• SQL Server Express Utility—You can use this command-line utility to perform various SQL Server maintenance tasks (www.microsoft.com/downloads/details.aspx?FamilyID=fa87e828-173f-472e-a85c-27ed01cf6b02)
• SQL Server Health and History Tool (SQLH2) Performance Collector—This tool collects performance counter data from your SQL Server systems and stores it in a repository (www.microsoft.com/downloads/details.aspx?familyid=64983AF0-7902-427E-9B41-7C2E8FDCC140)
• SQL Server Health and History Tool (SQLH2) Reports—Prevent performance problems by using this tool to collect and store change and trending information (www.microsoft.com/downloads/details.aspx?familyid=A4B837C7-A1FA-4F25-840B-FEF15E917F18)
• YourSQLDba—You can use this T-SQL stored procedure to automate routine database maintenance tasks such as database and log backups and consistency checks (www.grics.qc.ca/YourSqlDba)
Backup and Recovery
• Idera’s SQL safe Freeware Edition—This utility lets you back up and compress multiple databases of any size and offers a scriptable interface (www.idera.com/Products/Free-Tools/SQL-safe-Freeware-Edition)
• AppAssure’s DocRetreiver Lite—This free tool lets you restore individual documents back to a SharePoint farm from a SQL Server backup (www.appassure.com/applications/free-tools/docretriever-lite-for-sharepoint/)
Best Practice and Compliance
• Best Practices Analyzer Tool for Microsoft SQL Server 2000 1.0—You can use this tool to verify whether your SQL Server 2000 systems are managed and operated according to Microsoft’s SQL Server best practices (www.microsoft.com/downloads/details.aspx?FamilyID=b352eb1f-d3ca-44ee-893e-9e07339c1f22)
• Microsoft SQL Server 2005 Assessment Configuration Pack for Sarbanes-Oxley Act (SOX)—This configuration pack audits SQL Server systems to see if they meet the SOX configuration requirements (www.microsoft.com/downloads/details.aspx?familyid=976df931-a3cf-40e3-802e-3281b1451835)
• SQL Server 2005 Best Practices Analyzer—This utility checks your databases for potential problems by using SQL Server 2005 best practices configurations (www.microsoft.com/downloads/details.aspx?FamilyId=DA0531E4-E94C-4991-82FA-F0E3FBD05E63)
• SQL Server FineBuild—FineBuild lets you install SQL Server 2008 and 2005 with one click, and provides best practice configurations as well (www.codeplex.com/SQLServerFineBuild)

Free tools for business intelligence and DB admins:

 • BIDS Helper—This Visual Studio .NET add-in enhances SQL Server 2008 and 2005’s Business Intelligence Development Studio (BIDS) (www.codeplex.com/bidshelper)
• DTLoggedExec—With DTLoggedExec, each step executed by SSIS packages is logged, which makes configuring and troubleshooting SSIS packages fast and easy (dtloggedexec.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=21219)
• Microsoft SQL Server 2005 Data Mining Add-ins for Microsoft Office 2007—These add-ins let you use SQL Server 2005’s predictive analysis features in Microsoft Excel 2007 and Microsoft Visio 2007 (www.microsoft.com/downloads/details.aspx?FamilyID=7c76e8df-8674-4c3b-a99b-55b17f3c4c51)
• Microsoft SQL Server Metadata-Driven ETL Management Studio (MDDE)—You can use MDDE to quickly generate SSIS packages (sqlservermddestudio.codeplex.com)
• Reporting Services Scripter—This .NET Windows Forms application offers the ability to easily move SQL Server Reporting Services (SSRS) reports and catalog item properties between multiple servers (www.sqldbatips.com/showarticle.asp?ID=62)
• RSBuild—You can use this SSRS deployment tool to execute database scripts with ADO.NET and publish reports and data sources to SSRS (rsbuild.codeplex.com)
• SQL Nexus—This front-end visualization tool is used to load and analyze performance data that was collected by SQLDiag and PSSDiag (www.codeplex.com/sqlnexus)
Change Management
• SQLDBSearch 2.0—With SQLDBSearch 2.0, you can find objects that could be affected by a soon-to-be implemented database change (www.sqldbtools.com/Tools.aspx?ProductId=2)
• Tarantino Database Change Management—This utility makes it easier to apply database schema and database changes to multiple SQL Server systems (code.google.com/p/tarantino/wiki/DatabaseChangeManagement)
Code Formatters
• ApexSQL Refactor—This SQL Server Management Studio add-in offers 43 customizable options for formatting your SQL code and lets you preview your changes before you save them (www.apexsql.com/sql_tools_refactor.asp)
• Instant SQL Formatter—This tool not only reformats your SQL code but also turns your formatted SQL code into HTML code and translates your SQL code into other coding languages such as C# and Java (www.wangz.net/gsqlparser/sqlpp/sqlformat.htm)
• Manoli C# Code Format—You can use this tool to format code to the HTML 4.01 specification for a website or blog (www.manoli.net/csharpformat)
• Simple-Talk Code Prettifier—This tool converts your ASCII source code into HTML code so that you can paste it into an online element such as a blog or website (www.simple-talk.com/prettifier/default.php)
• SQLinForm—With this SQL code formatter, SQL statements aren’t transferred over the Internet and there’s nothing to install (www.sqlinform.com)
Database Comparison
• CompareData—This utility uses ODBC drivers to compare and synchronize data between two SQL Server databases (www.zidsoft.com)
 • Open DBDiff—This database schema comparison tool provides you with a report showing the differences between two database schemas and includes a synchronization script that you can use to update the databases (www.codeplex.com/OpenDBiff)
• SQL Accord Community Edition for Microsoft SQL Server—This tool offers schema comparison features via an interactive GUI (www.sqleffects.com/Articles/Product/sqlAccordInfo/aboutSqlAccordCommunityEd.html)
• SQLDBDiff—You can use this tool to compare and synchronize SQL Server 2005 and 2000 database schemas (www.sqldbtools.com)
• TableDiff.exe GUI—With TableDiff.exe GUI, you no longer have to run the TableDiff.exe table comparison tool (found in SQL Server 2005) from the command line (weblogs.sqlteam.com/mladenp/archive/2007/08/10/60279.aspx)
Database Security
• Devenius SQL Encryption Assistant Basic Edition—You can use this SQL Server Management Studio add-in to manage your encryption keys (www.devenius.com/sql_server_tools/sql_encryption_assistant/SEA.aspx)
• Idera’s SQL permissions—You can use this tool to move or copy SQL Server login information and permissions setting between servers (www.idera.com/Products/Free-Tools/SQL-permissions)
• Lockdown.sql—Your SQL Server systems are locked down to the most secure configuration, letting you deploy systems that have only required functionality enabled (www.sqlsecurity.com/Tools/LockdownScript/tabid/64/Default.aspx)
• Microsoft Baseline Security Analyzer 2.1—This tool performs vulnerability assessment checks on your SQL Server systems to verify their security (technet.microsoft.com/en-us/security/cc184923.aspx)
• SQLPing 3.0—SQLPing scans your network to find new and unprotected SQL Server and MSDE instances (www.sqlsecurity.com/Tools/FreeTools/tabid/65/Default.aspx)
Development
• DbFit—You can use DbFit to run Framework for Integrated Testing (FIT) tests directly against databases, making it easier to perform integration testing on databases (www.fitnesse.info/dbfit)
• ScriptDB—This application scripts database objects using SQL Server Management Objects (SMO) (www.codeplex.com/ScriptDB)
• SpatialViewer—This utility lets you view spatial data easily (www.codeplex.com/SpatialViewer)
• SQL Server PowerShell Extensions (SQLPSX)—This tool helps make working with SMO from PowerShell easier by offering PowerShell functions around SMO objects (sqlpsx.codeplex.com)
• SQL Spatial Tools—SQL Spatial Tools includes two tools: Shape2SQL, which you use to upload ESRI files to SQL Server Spatial, and SQLSpatial Query Tool, which queries SQL Server 2008 and displays the geometry output via a Windows Presentation Foundation map (www.sharpgis.net/page/SQL-Server-2008-Spatial-Tools.aspx)
• SQLCLRProject—With SQLCLRProject, you can use MSBUILD tasks to deploy .NET assemblies to SQL Server 2008 and 2005 (www.codeplex.com/sqlclrproject)
• SQLIO Disk Subsystem Benchmark Tool—With this tool, you could find out what the I/O capacity of a SQL Server configuration is (www.microsoft.com/downloads/details.aspx?familyid=9a8b005b-84e4-4f24-8d65-cb53442d9e19)
• SQLScripter—This command-line utility automates schema generation and scripts SQL Server 2005 databases (www.valinor.co.il/tools-sqlscripter.asp)
• SQLsharp—This free tool offers a CLR library of useful functions that you can use to write better SQL code in SQL Server 2008/2005 (www.sqlsharp.com)
• SSMS Tools Pack—This suite of tools enhances SSMS’s functionality with features such as a query template tool and a CRUD procedure-generation tool (www.ssmstoolspack.com)
• Stored Procedure Generator—This tool generates the stored procedures necessary to access tables in SQL Server (spgen.codeplex.com)
• tsqlt—As a unit testing framework for T-SQL, tsqlt helps isolate functionality to be tested (sourceforge.net/projects/tsqlt)

Free tools for DB job management or sysadmin performance monitoring:

Stress test tool, Heavy Load free tool from JAM software: https://www.jam-software.de

• Idera’s SQL job manager—With SQL job manager, you can view and manage SQL Server Agent jobs across multiple SQL Server systems from a central administration console (www.idera.com/Products/Free-Tools/SQL-job-manager)
• JAMS Monitor—With JAMS Monitor, you can manage Windows Task Scheduler and SQL Server jobs and ensure that they’re running successfully from a centralized management console (www.mvpsi.com/FreeMonitor.aspx)
Log Management
• Log Parser 2.2—You can use this tool to access text-based data (e.g., log files, XML files), as well as data sources in Windows (e.g., Active Directory, the event log) (www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07)
• PSSDIAG Data Collection Utility—This diagnostic data collector can be used to gather logs and data files (www.microsoft.com/downloads/details.aspx?familyid=5564386A-28C2-4483-8293-76FFF67B9EB3)
Performance and Monitoring
• ClearTrace—You can use this graphical display tool to summarize query performance data from server-side trace and SQL Server Profiler sessions (www.cleardata.biz/cleartrace/default.aspx)
• DMVStats 1.01—You can use this tool to collect, analyze, and report on performance data from SQL Server 2005 Dynamic Management Views (DMVs) (www.codeplex.com/sqldmvstats)
• Idera’s SQL check—This tool runs as a secure screensaver and monitors your SQL Server systems, as well as offers a look at processes, error logs, and SQL Server Agent jobs (www.idera.com/Products/Free-Tools/SQL-check)
• Internals Viewer for SQL Server—You can use this tool to see how data is allocated, organized, and stored in the SQL Server storage engine (internalsviewer.codeplex.com)
• MDX Script Performance Analyser—You can use this tool to identify which statements in your SQL Server Analysis Services (SSAS) MDX script are negatively affecting MDX query performance (www.codeplex.com/mdxscriptperf)
• Performance Analysis of Logs (PAL) Tool—PAL automates the collection and analysis of performance counters in the Performance Monitor Counter log (www.codeplex.com/PAL)
• Quest Discovery Wizard for SQL Server (beta)—You can use this tool to monitor your network for changes and find all your SQL Server instances (www.quest.com/discovery-wizard-for-sql-server)
• RML Utilities for SQL Server (x86)—With this tool, you can monitor SQL Server performance by processing SQL Server trace files and viewing reports, and test how a specific change will affect your SQL Server systems (www.microsoft.com/downloads/details.aspx?FamilyId=7EDFA95A-A32F-440F-A3A8-5160C8DBE926)
• SQLIOSim—SQLIOSim replicates SQL Server’s types and patterns of I/O requests on a disk subsystem and verifies data similarly to how SQL Server would in a production environment (blogs.msdn.com/sqlserverstorageengine/archive/2006/10/06/SQLIOSim-available-for-download.aspx)
• SQLQueryStress—This tool is helpful when performance stress testing T-SQL queries because it collects data about whether your queries will run under load, and each query’s resource usage (www.datamanipulation.net/sqlquerystress)
• SQL Server 2005 Performance Dashboard Reports—These reports help you quickly identify performance bottlenecks and provide the information necessary to resolve them (www.microsoft.com/downloads/details.aspx?FamilyId=1d3a4a0d-7e0c-4730-8204-e419218c1efc)
• SQL Server Cache Manager—Find out what is being stored in the SQL Server cache and if the cache is being used efficiently with this free tool (www.codeplex.com/sqlservercache)
• SQL Server DBA Dashboard—This tool uses graphs and reports, which are integrated with SSMS, to identify what is using your SQL Server systems’ resources (www.sqlserverexamples.com/v2/Products/tabid/76/Default.aspx)
Prevent SQL Server Injection Attacks
• bsqlbf-v2—This Perl script lets you extract data from blind SQL injections (code.google.com/p/bsqlbf-v2)
• HP Scrawlr—This scanner tool crawls your web pages, checking for SQL injection vulnerabilities (www.communities.hp.com/securitysoftware/blogs/spilabs/archive/2008/06/23/finding-sql-injection-with-scrawlr.aspx)
• Microsoft Source Code Analyzer for SQL Injection—You can use this tool to find SQL injection vulnerabilities in ASP code (support.microsoft.com/kb/954476)
• URLScan—URLScan restricts the type of HTTP requests Microsoft IIS will process (learn.iis.net/page.aspx/473/using-urlscan)
Web Administration
• SQL Server Hosting Toolkit—The SQL Server Hosting Toolkit offers two tools: the Database Publishing Wizard, which you can use to upload your databases to a hosting environment, and the Database Publishing Services, which offers ASP.NET web services that can make it easier for you to deploy databases (sqlhost.codeplex.com)
• SQL Server Web Tools—This web-based administration tool lets you perform management tasks, including administering accounts, managing databases and tables, and creating and running queries and stored procedures (sqlwebtools.codeplex.com)
• SQL Web Data Administrator—This SQL Server management tool lets you create and edit databases, export and import database schema and data, and more (www.codeplex.com/SqlWebAdmin)
Who Says Nothing in Life Is Free?
Although this list includes dozens of free SQL Server tools, it doesn’t include them all. If you know about a free SQL Server utility that’s not on this list, we want to hear about it: You can email me at mkeller@sqlmag.com. Also, please share your feedback about the tools included in this list in the Tool Time forum at www.sqlmag.com/forums. For even more free tools, see the sidebars “Free SQL Server Projects and Samples” and “Free PowerShell Scripts for SQL Server.”

Security and Forensics: Enable PowerShell logging

$
0
0

Introduction:

PowerShell is a great language but with the power and capabilities that PowerShell has to offer also come risks. PowerShell logging is turned off by default, but there are two easy ways to enable logging so that you can get some insight into what commands are being executed and collect information for security forensics.

Enable logging using GPO:

If you want to enable logging on more than one server, it may be more convenient to use Group Policy (or using locally GPEDIT.msc) to push out the necessary settings. In the Group Policy Management Editor, you can find the configuration settings for PowerShell under:

Computer Configuration, Policies, Administrative Templates, Windows Components, and Windows Powershell

AND

User Configuration, Policies, Administrative Templates, Windows Components, and Windows Powershell

The Group Policy Object (GPO) setting you need is called Turn on Module Logging:

Microsoft.PowerShell.*

Microsoft.WSMan.Management

ActiveDirectory

Note: specifically for the Active Directory module. Enabling logging for the core modules gives more detail in the event log when running the get-aduser cmdlet, such as to which AD objects the command binds. Once you’ve configured the policy setting and made sure the GPO is linked to an OU, you should reboot the affected server(s).

Also enable

The Group Policy Object (GPO) setting you need is called Turn on PowerShell Script Block Logging

and

The Group Policy Object (GPO) setting you need is called Turn on PowerShell Transcription:

and you must specify a target directory to store the result of the powershell scripts ie. d:\PS_Logs

(don’t forget to turn off PowerShell transcription because it will fill-in your disk space)

 

Finally how to use the results of the PS logging:

a) look the results on the PS_Logs directory

b) open Event Viewer from the Tools menu in Server Manager and expand the default Windows Powershell event log and the operational log located under: Applications and Services Log, Microsoft, Windows, and PowerShell, then select the Operational log.

Note: Modify the default Windows PowerShell log and the Operational log size to enter a greater value.

 

PowerShell – Simple network remote capture tool !

$
0
0

Full article:

https://blogs.technet.microsoft.com/askpfeplat/2017/12/04/simple-powershell-network-capture-tool/

Topic #1: What is the purpose of this tool as opposed to other tools available?

This certainly should be the first question. This tool is focused toward delivering an easy to understand approach to obtaining network captures on remote machines utilizing PowerShell and PowerShell Remoting.

I often encounter scenarios where utilizing an application such as Message Analyzer, NETMON, or Wireshark to conduct network captures is not an option. Much of the time this is due to security restrictions which make it very difficult to get approval to utilize these tools on the network. Alternatively, it could be due to the fact that the issue is with an end user workstation who might be located thousands of miles from you and loading a network capture utility on that end point makes ZERO sense, much less trying to walk an end user through using it. Now before we go too much further, both Message Analyzer and Wireshark can help on these fronts. So if those are available to you, I’d recommend you look into them, but of course only after you’ve read my entire post.

Topic #2: Where can I get this tool?

https://gallery.technet.microsoft.com/Remote-Network-Capture-8fa747ba

 

 

Security – Run Kali Linux on Windows 10

$
0
0

Reference: https://thehackernews.com/2018/03/kali-linux-hacking-windows.html

Now you can download and install Kali Linux directly from the Microsoft App Store on Windows 10 just like any other application:

First install the Linux subsystem and restart:

You can even do the same by opening PowerShell as Administrator and running the following command and restart your computer.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

 

 

PowerShell Remoting with SSH – SFTP (and SSH) using Powershell

$
0
0

PowerShell remoting with SSH:

https://docs.microsoft.com/en-us/powershell/scripting/core-powershell/ssh-remoting-in-powershell-core?view=powershell-6

========================================================================================

How to use SFTP (and SSH) with Powershell?

http://www.powershellmagazine.com/2014/07/03/posh-ssh-open-source-ssh-powershell-module/

https://github.com/darkoperator/Posh-SSH

or Using WinSCP: http://winscp.net/eng/docs/library_powershell#using_from_powershell

Else other:

SFTP powershell snap-in: http://www.k-tools.nl/index.php/download-sftp-powershell-snap-in/

and paying software: http://www.powershellserver.com/download/

 

example of code using POSH SSH to use SFTP for secure file transfer (certified working! ;)))

$sftpUser = “myaccount”
$sftpServer = “103.x.y.z”
$LocalFile = “d:\data\filetoupload.txt”
$sftpPass = ConvertTo-SecureString -String “ttIJP0YPuPS6” -AsPlainText -Force
$sftpCred = new-object -typename System.Management.Automation.PSCredential -argumentlist $sftpUser, $sftpPass
$sftpSession = New-SFTPSession -ComputerName $sftpServer -Credential $sftpCred

Set-SFTPFile -SFTPSession $sftpSession -LocalFile $Localfile -RemotePath “/tmp/mydirectory/” -Overwrite

 

 

PowerShell Core and PowerShell what is the difference?

$
0
0

PowerShell Core 6.0 is a new edition of PowerShell that is cross-platform (Windows, macOS, and Linux), open-source, and built for heterogeneous environments and the hybrid cloud.

The goal of PowerShell Core is to remain as compatible as possible with Windows PowerShell. PowerShell Core uses .NET Standard 2.0 to provide binary compatibility with existing .NET assemblies

Microsoft will not replace the standard PowerShell by PowerShell Core. Both will coexist side by side until further notice.

powershell

pwsh

https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-core-60?view=powershell-6

 


PowerShell – How to call a webservice REST or SOAP ?

$
0
0

Deciding which protocol to use for which service

The key distinguishing factor for our service will be found in the URL of the resource… If our URL looks like X, then it is a Y service, and you use Z tool to get to it

URL Service Type Cmdlet
Ends in .asmx or ?WSDL SOAP New-WebServiceProxy
Contains API, especially api/v2 REST Invoke-RESTMethod
Ends in .php PHP/Form Invoke-WebRequest

REST v. Soap, whats the difference?

Both REST and SOAP are simply methods of accessing information presented via web services. It will suffice to say that REST is now in vogue, and is generally believed to be easier to use and manage than SOAP, which tends to be a bit heavier on XML.

“A nice analogy for REST vs. SOAP is mailing a letter: with SOAP, you’re using an envelope; with REST, it’s a postcard. ”

Resources:

https://www.codeproject.com/Tips/794949/Query-Webservices-with-Powershell

Working with Web Services, SOAP, PHP and all the REST with PowerShell

Security – detecting PowerShell empire C2C activity

How to determine which version of .net framework is installed?

$
0
0

Reference: http://support.microsoft.com/kb/318785

Microsoft .net Framework is a software package that is used by many applications, it runs in a software environment as opposed to hardware environment.

Free program called .NET Version Detector ( download here ).

PowerShell: how to get version of .net framework on a remote computer: https://gallery.technet.microsoft.com/scriptcenter/Detect-NET-Framework-120ec923

To query the local Registry using PowerShell, execute the below command in an elevated PowerShell session.

(Get-ItemProperty ‘HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full’  -Name Release).Release

You can then use the table below to reference the installed version of .NET. For instance, if the returned value is 379893, then .NET 4.5.2 is installed.

Windows – Windows Admin Center (formerly honolulu)

$
0
0

Windows Admin Center:

https://docs.microsoft.com/en-us/windows-server/manage/windows-admin-center/overview

https://blogs.technet.microsoft.com/servermanagement/2018/04/12/windows-admin-center-formerly-project-honolulu-is-now-generally-available/

https://cloudblogs.microsoft.com/windowsserver/2018/04/12/announcing-windows-admin-center-our-reimagined-management-experience/

Installation:

You can install Windows Admin Center on the following Windows operating systems:

Version Installation Mode
Windows 10 (1709) Desktop mode
Windows Server, version 1709 Gateway mode
Windows Server 2016 Gateway mode

Desktop Mode: Connect to the Windows Admin Center gateway from the same computer on which it’s installed (for example, https://localhost:6516)

Gateway Mode: Connect to the Windows Admin Center gateway from a client browser on a different machine (for example, https://servername)

How do I create a registry value in a remote computer in PowerShell ?

$
0
0

To create a registry value remotely:

Example:

PS D:\> enter-pssession -computername server.mydomain.local
[server.mydomain.local]: PS C:\Users\admin\documents> set-itemproperty -path HKLM:\System\CurrentControlSet\Services\NTDS\Parameters -Name “Maximum Audit Queue Size” -value 0x61a8
[server.mydomain.local]: PS C:\Users\admin\Documents> exit-pssession

Links:

https://www.computerperformance.co.uk/powershell/registry/

https://blogs.technet.microsoft.com/heyscriptingguy/2012/05/10/use-powershell-to-create-new-registry-keys-on-remote-systems/

PowerShell – how to power off a computer

$
0
0

# Try without doing anything bad

Stop-Computer -WhatIf

# Stop the local computer

Stop-Computer

# Try without doing anything bad on multiple systems

Stop-computer -ComputerName ‘computer1′,’computer2′,’computer3’ -whatif

# Stop multiple systems

Stop-computer -ComputerName ‘computer1′,’computer2′,’computer3’

Powershell – run parallel scripts


AD: Be protected against “Pass the Hash” attacks

$
0
0

Understanding and Troubleshooting MS RPC

$
0
0

Overview:

A very brief summary of how the protocol works: There is an “endpoint mapper” that runs on TCP port 135.
You can bind to that port on a remote computer anonymously and enumerate all the various RPC services
available on that computer.  The services may be using named pipes or TCP/IP.  Named pipes will use port 445.
The services that are using TCP are each dynamically allocated their own TCP ports,
which are drawn from a pool of port numbers. This pool of port numbers is by default 1024-5000 on XP/2003
and below, and 49152-65535 on Vista/2008 and above. (The ephemeral port range.)

You can customize that port range that RPC will use if you wish, like so:

reg add HKLM\SOFTWARE\Microsoft\Rpc\Internet /v Ports /t REG_MULTI_SZ /f /d 5200-10200
reg add HKLM\SOFTWARE\Microsoft\Rpc\Internet /v PortsInternetAvailable /t REG_SZ /f /d Y
reg add HKLM\SOFTWARE\Microsoft\Rpc\Internet /v UseInternetPorts /t REG_SZ /f /d Y

And/Or
netsh int ipv4 set dynamicport tcp start=5200 num=10200
netsh int ipv4 set dynamicport udp start=5200 num=10200
netsh int ipv6 set dynamicport tcp start=5200 num=10200
netsh int ipv6 set dynamicport udp start=5200 num=10200

I found this very interesting article about how to troubleshoot RPC communications:

http://blogs.technet.com/b/askds/archive/2012/01/24/rpc-over-it-pro.aspx

http://social.technet.microsoft.com/wiki/contents/articles/4494.aspx

http://technet.microsoft.com/en-us/magazine/2007.07.howitworks.aspx

Tools:

rpcdump (from old windows service pack)

test-server  ; powershell script here: https://gallery.technet.microsoft.com/scriptcenter/Powershell-Test-Server-e0cdea9a

test-rpc       ; powershell script here:

rpc-ping     ; powershell script here: http://www.zerrouki.com/rpc-ping/

portqry -n computer -e 135

netmon 3.4

rpcping

rpings

 

Introduction

Remote Procedure Call (RPC) is an inter-process communication technique to allow client and server software to communicate on a network. The RPC protocol is based on a client/server model. The client makes a procedure call that appears to be local but is actually run on a remote computer. During this process, the procedure call arguments are bundled and passed through the network to the server. The arguments are then unpacked and run on the server. The result is again bundled and passed back to the client, where it is converted to a return value for the client’s procedure call.

RPC is used by several components in Windows Server, such as the File Replication Service (FRS), Active Directory Replication, Certificate services, DCOM, domain join, DCPromo and RDP, NLB and Cluster, Microsoft Operations Master, Exchange and SQL.

The RPC Server

An RPC server is a communications interface provided by an application or service that allows remote clients to connect, pass commands, and transfer data using the RPC protocol. A typical example of an RPC server is Microsoft Exchange Server. Microsoft Exchange Server is an application running on a computer that supplies an RPC communications interface for an RPC client.

An application will register its RPC server with the operating system’s End Point Mapper (EPM) service so that the remote client can locate the RPC server. When the application registers with the EPM it will indicate the IP address and TCP port that it is listening on.

The RPC Client

An RPC client is an application running on any given computer that uses the RPC protocol to communicate with an RPC server. An example of a typical RPC client is the Microsoft Outlook application.

NOTE: In this document the terms RPC server and RPC client refer to the application running at both ends of an RPC communication.

RPC Quick Fixes

Common causes of RPC errors include:

  • Errors resolving a DNS or NetBIOS name.
  • The RPC service or related services may not be running.
  • Problems with network connectivity.
  • File and printer sharing is not enabled.

Use the following procedures to diagnose and repair common causes of RPC errors.

Unable to resolve DNS or NetBIOS names in an Active Directory environment

  1. Use the following commands to verify DNS is working for all DC’s or specific DC’s:
  • To get a DNS status for all DCs in forest, run the following command:
  • DCDIAG /TEST:DNS /V /E /F:<filename.log>
  • The “/e” switch runs the DNS test against all DCs in an Active Directory Forest

To get DNS health on a single DC, run the command below.

  • DCDIAG /TEST:DNS /V /S:<DCNAME> /F:<filename.log>
  • The “/s:” switch runs the DNS test against a specified domain controller.

To verify that a domain controller can be located for a specific domain, run the command below.

  • NLTEST /DSGETDC:<NetBIOS or DNS domain name>
  1. Servers and clients that are receiving the error should be checked to verify that they are configured with the appropriate DNS server. Servers should not be pointing to their ISP’s DNS servers in the preferred or alternate DNS server portion of the TCP/IP settings. The ISP’s DNS servers should only be used as forwarders in DNS.
  1. Ensure that at least one correct DNS record is registered on each domain controller.
  • To ensure that a correct DNS record is registered on each domain controller, find this server’s Active Directory replication partners that run DNS.
  • Open DNSManager and connect in turn to each of these replication partners.
  • Find the host (A) resource record registration for this server on each of the other replication partner domain controllers.
  • Delete those host (A) records that do not have IP addresses corresponding to any of this server’s IP addresses.
  • If a domain controller has no host (A) records for this server, add at least one that corresponds to an IP address on this server. (If there are multiple IP addresses for this server, add at least one that is on the same network as the domain controller you are updating.)
  1. Name resolution may also fail with the RPC Server is unavailable error if NetBIOS over TCP/IP is disabled on the WINS tab in the advanced section of the TCP/IP properties. The NetBIOS over TCP/IP setting should be either enabled or default (use DHCP).
  1. Verify that a single label domain name is not being configured. DNS names that do not contain a suffix such as .com, .corp, .net, .org or .local are considered to be single-label DNS names. Microsoft doesn’t recommend using single label domain names because they cannot be registered with an Internet registrar and domain members do not perform dynamic updates to single-label DNS zones. Knowledge base article 826743 – “Clients cannot dynamically register DNS records in a single-label domain” provides instructions on how to configure your domain to allow dynamic registration of DNS records in a single label domain.

The RPC service or related services may not be started

Verify the status and startup type for the RPC and RPC locator services on the server that gets the error:

  1. By default, Windows server 2003 domain controllers and member servers all should have the RPC service started and set to Automatic startup and the RPC Locator service stopped and set to Manual Startup.
  2. Windows 2000 domain controllers should have the RPC and RPC Locator services both set to started and automatic startup, while Windows 2000 member servers should have the RPC service started and set to automatic startup while the RPC locator service should be started and set to manual startup.
  3. If you make any changes to the RPC service or to the RPC Locator service settings, restart the computer, and then test for the problem again.
  4. Additional Services that may result in “The RPC Server is Unavailable” errors are the TCP/IP NetBIOS helper service, Distributed File System service and Remote Registry service. These services should both be set to automatic and started. The Kerberos Key Distribution Center (KDC) should be Started and Automatic on Windows 2000 and Windows 2003 DCs. It should not be started and set to Disabled in all other cases.

Network Connectivity

Verify ports needed by RPC are open

Verify that ports greater than 1024 are not blocked. Clients connect to RPC Endpoint Mapper on port 135. RPC Endpoint Mapper then tells the client which randomly assigned port between 1024-65535 a requested service is listening on.

Ports may be blocked by a hardware firewall or a software firewall. Software firewalls include Internet Connection Firewall on computers running Windows Server 2003 or Windows XP, and Windows Firewall on computers running Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2. A computer might also have third-party firewall software installed, or antivirus software with built-in firewall functionality. By default, port 135 TCP/UDP and ports 1024-65535 TCP must be open for RPC to work. You can restrict the ports greater than 1024 that RPC uses. However, RPC Endpoint Mapper is always on port 135.

File and Printer Sharing is not enabled

File and Printer sharing for Microsoft Networks will produce the error “RPC Server is unavailable” when you try to view or manage services on a remote computer using the Services snap-in. See the following example:

Unable to open service control manager database on \<computer>.
Error 1722: The RPC server is unavailable.
This error message may occur if the File and Printer Sharing for Microsoft Networks component is not enabled on the remote computer.

Troubleshooting RPC

The process of an RPC client connecting to an RPC server can be broken down into four phases. This troubleshooting guide will discuss the events that occur at each phase, how to test these events, and how to identify if the phase completed successfully.

Phase 1: Name Resolution: Name resolution is the act of resolving a name to an IP address. This normally takes two forms: NetBIOS Name Resolution or the more common DNS Name Resolution.

Phase 2: TCP session establishment: TCP session establishment is the act of establishing a TCP connection between the RPC client and the RPC server. TCP sessions will be initiated by the RPC client via a TCP 3-way handshake with the RPC server.

Phase 3: RPC Discovery: When a client wants to connect to the RPC server supplied by the application it will contact the computer that hosts the RPC Server and discover how to connect to the RPC Server.

Phase 4: RPC Communication: RPC Communication is the act of making RPC requests to the application endpoint and receiving RPC responses from this application.

Data needed to troubleshoot the issue:

  • Identify the client and server computers reporting the RPC error. Identify the DNS and WINS servers used by these computers. To do this:
  • On each machine, open a command prompt and run ipconfig /all.
  • Determine the IP address of both machines. If the server is part of a cluster get the cluster resource IP address as well. Identify the DNS servers and WINS servers that the RPC client is configured to use.

Note: You can also obtain this information by opening Control PanelNetwork and Sharing Center, clicking Local Area Connection and selecting Properties.

  • Identify the application(s) reporting RPC Server Unavailable
  • Simultaneous network traces (using Wireshark, Netmon, or a comparable network sniffer) from the machines hosting the RPC client and RPC Server while reproducing the task that results in a “RPC Server Unavailable” error.
  • The network captures on both hosts should be started first.
  • From a command prompt on the client run ipconfig /flushdns and nbtstat –R to clear the name resolution caches.
  • Reproduce the error.
  • Stop the traces and save them.

Name Resolution

Name Resolution consists of one or possibly more NetBIOS or DNS queries to locate the IP address for the RPC Server. Troubleshooting this phase requires verifying that a response is received to the name resolution request and that the response contains the correct IP address for the RPC server. Compare the IP address reported by DNS or NetBIOS in the network trace for the server with the IP addresses you noted earlier. If it does not match then check DNS and WINS and note if there is a difference.

DNS Name Resolution

To identify DNS Name Resolution in a network trace use the following filter in Network Monitor or Wireshark: “dns”. DNS resolution will be occurring at the client so open the network trace taken from the RPC client machine. You will be looking for one packet that is the query from the client to the DNS server and then the response packet from the DNS server. It will look similar to this:

If the trace shows the correct IP address for the RPC server was returned by the DNS server proceed to TCP Session Establishment.

If the trace does not show a correct IP address returned or you do not see any answer from the DNS server then reference the following resources to help with DNS name resolution troubleshooting.

For details on troubleshooting Active Directory related DNS issues go here.

For general DNS troubleshooting: http://support.microsoft.com/default.aspx?scid=kb;EN-US;330511

NetBIOS Name Resolution

NetBIOS queries come in two forms, WINS or NetBIOS Broadcasts. WINS will consist of a unicast query to a WINS server and a response from the WINS server.

NetBIOS broadcasts are queries broadcast to all hosts on the local subnet so name resolution is limited to only hosts on the subnet. The host with the name listed in the NetBIOS Broadcast will respond with its IP address.

To identify NetBIOS Name Resolution in a network trace, use the following filter in Network Monitor – “nbtns”. For Wireshark, use the following filter – ”nbns”. If the trace shows a successful resolution using WINS or NetBIOS queries proceed to TCP Session Establishment.

For details on troubleshooting this NetBIOS Name Resolution further:

http://technet.microsoft.com/en-us/library/cc940110.aspx

TCP Session Establishment

TCP Sessions always begin with a TCP 3-way handshake. The handshake should look similar to what is shown below. The RPC Client will send the first packet, known as the SYN packet. The computer hosting the RPC Server will send a SYN/ACK response, and then the RPC Client will send an ACK packet.

Scenarios that may cause the TCP session to fail

Firewall/Network

If a firewall or network problem is the culprit, it is likely a failure will occur during this phase. To diagnose this you will want to look at the network traces taken from the RPC Client and RPC Server. If a firewall or other network device is causing a problem it will usually manifest as a retransmit of the TCP SYN packet by the RPC Client about 3 seconds after the first TCP SYN is sent. This can be seen in a Netmon network trace using the display filter specification of “tcpsynretransmit==1”. In other cases, firewalls will allow the 3-way handshake to succeed but may block the RPC packets due to the contents of the packet at a higher level. In these cases it is possible to see the retransmit of the RPC packet within half a second of the original packet being sent. To identify this condition in a Netmon network trace use the display filter specification of “tcpretransmit==1”. To see either of these retransmit conditions in a trace taken using Wireshark use the display filter specification of “tcp.analysis.retransmission”.

The RPC Server is not actively listening.

It was noted earlier that an RPC Server will register itself and listen on a particular port and IP address of the host computer. If for some reason that fails the TCP layer will answer the SYN packet from the client with a Reset packet.

A device in the middle between the RPC Client and RPC Server will be resetting the connection attempt.

In the client side trace it will appear as if the server sent the TCP Reset while the trace from the server indicates the client is the source of the TCP Reset.

For both these scenarios, check for the presence of a Reset packet in the TCP three way handshake by using the display filter specification of “TCP.flags.reset==1”.

For troubleshooting this step see the following sections in this document:

If the 3-way handshake is successful, continue to the RPC Discovery phase.

RPC Discovery

The RPC Discovery phase will occur one of two ways. In both methods the client will know the identifier for the RPC Server it wants to contact and will supply that to the computer hosting the RPC Server and ask for information on how to contact the RPC Server. The identifier is different depending on which method is used and the RPC client will know ahead of time which method it wishes to use.

Discovery – RPC Over TCPIP

This method is a two-step process. First the RPC client will contact the End Point Mapper (EPM) on the machine hosting the RPC Server to find out what port and IP address that Server is listening on. Upon successful completion of this the RPC client will contact the RPC Server directly on the indicated IP address and Port. Below is a sample of what this would look like and a step by step explanation below it. This step depends on the successful TCP session establishment twice, first to the EPM and then to the RPC Server.

  1. The RPC Client will open a TCP session with TCP port 135 on the computer hosting RPC Server of interest. This can be picked out using the following filter syntax in Netmon or Wireshark: “tcp.port==135”
  2. The RCP Client will send an RPC Bind request using the UUID of the End Point Mapper and the RPC EPM should respond with a Bind ACK packet.
  3. The RPC Client will make a MAP request to the EPM to locate the IP address and port of the RPC Server of interest, identifying the RPC Server based on its UUID.
  4. The EPM will send back a MAP Response that indicates the IP and port the RPC Server is listening on.
  5. The RPC Client will then open a TCP session with the IP and port it received in the EPM MAP response.
  6. The client will send an RPC Bind Request to the RPC Server specifying the UUID of the RPC Server application and should get back a Bind ACK from the RPC Server.
  7. There will be an RPC Alter Context Request/Response in which authentication will take place. If an error is noted here then see the following section for help determining why the error is occurring – Authentication
  8. Perform some RPC operations…(Go to RPC Communication phase)

Discovery – RPC Over SMB

The second method an RPC Client may use to contact an RPC Server is RPC over SMB. This method depends upon first establishing an SMB session with the computer hosting the RPC Server and then using the Named Pipes protocol to communicate using RPC. So in effect there are several levels of encapsulation – RPC over Named Pipes over SMB over TCP. We will not address the SMB session setup in this document and the TCP session establishment has already been discussed.

With a successfully opened TCP and SMB session, next:

  1. The RPC Client will issue a SMB TreeConnectAndX for the tree name “IPC$”. This is a special hidden share for inter-process communication. It should get a positive response from the computer hosting the RPC Server.
  2. The RPC Client will then issue an SMB NTCreateAndX for the name of the PIPE of the RPC Server Application and should get back a positive response. Some examples are:

EVENTLOG = The Event log service

winreg = Remote Registry

svcctl = Service Control Manager

srvsvc = Server Service

  1. Next there is a Bind handshake. This is to “bind” the RPC client to the RPC server. There are a total of four packets involved:
  1. The RPC Client bind request containing the UUID of the desired RPC Server.
  2. A Write AndX response from the RPC Server
  3. A Read AndX request from the RPC Client.
  4. A Bind ACK response from the RPC Server.

At this time a RPC request to the RPC server component is expected.

RPC Communication

At this point RPC communication is occurring between the RPC Client and RPC Server. The troubleshooting steps involved at this stage are largely based on the application reporting the RPC failure.

For Active Directory processes or services please see Active Directory Symptoms.

For Microsoft Exchange related RPC errors please see: Analyzing Exchange RPC traffic over TCP/IP

How to identify the RPC traffic in a trace

RPC network traffic can take multiple forms. It is important to understand which form is in use in order to identify which TCP session is responsible for the RPC communication.

RPC over TCPIP

This is sometimes referred to as Traditional RPC or Sockets based RPC. An example of this is Outlook without “Outlook anywhere” or without http settings configured. A TCP session on TCP port 135 is established with the RPC server. To view this traffic in a trace use the filter: “tcp.port==135”. This session will be used in the RPC Discovery phase to locate the endpoint of the desired application.

RPC over HTTP

RPC connectivity for Internet connected hosts will typically use RPC over HTTP in order to traverse firewalls. Some examples of this can be seen with Terminal Services Gateway, Outlook Web Access, Outlook via “Outlook Anywhere”. This communication will be established on one or more connections to either TCP port 80 or 443(SSL). Since this typically traverses a public network, SSL or TCP port 443 is the more common method. Use the filter “tcp.port==80 or tcp.port==443” to locate either form inside network trace.

RPC over HTTP Port 80

For sessions over TCP port 80, the HTTP requests associated with RPC over HTTP will include a UserAgent header that contains the text “OutlookConnectorDS” and the version number of the connector.

RPC over HTTP Port 443

Sessions using TCP port 443 will initially establish a TLS session. After this TLS negotiation, the TCP Payload will be encrypted in TLS/SSL and the contents of the frames will not be readable in the trace. In this phase, look for failures due to improper certificates, inaccessible Certificate Revocation Lists, or untrusted certificate chains.

For more information on troubleshooting SSL/TLS see:

http://technet.microsoft.com/en-us/library/cc783349(WS.10).aspx

RPC over SMB aka “Named Pipes”

RPC can also take advantage of SMB sessions for the purpose of RPC communication. Some examples of this can be seen with Computer Management or the Remote Registry service. With the use of RPC over SMB:

  1. Establish TCP connection on TCP port 139 or 445.
  2. Negotiate dialect request/response
  3. SessionSetupANDX request/response. This sequence is used to establish the SMB Session. Authentication occurs during the SessionSetupANDX exchange.

If a failure in step 1 occurs, see additional troubleshooting steps see: File and Printer Sharing.

Kerberos Authentication

If Kerberos is used, and the client doesn’t currently have a Kerberos ticket for the RPC server, just after the Negotiate Dialect response is received, the client will obtain a Kerberos ticket for the Servername/cifs SPN of the RPC server. This exchange will occur over the Kerberos ports TCP or UDP port 88 between the client and a Domain Controller. SessionSetupANDX follows and will consist of a single SessionSetupANDX request which includes the Kerberos ticket, followed by a SessionSetupANDX Response indicating success or failure of the authentication.

For additional troubleshooting steps during authentication, see Authentication.

NTLM Authentication

If NTLM is used, SessionSetup will result in a SessionSetupANDX response with a status of STATUS_MORE_PROCESSING_REQUIRED. This response includes the NTLM challenge. The subsequent SessionSetupANDX Request will include the hashed credentials of the client. At this time, the RPC server must validate the credentials supplied by the user. To do this, the RPC server will contact a domain controller, and validate the credentials with the netlogon service, via RPC, on the domain controller. If this is successful, the RPC server will then respond to the client with a SessionSetupANDX Response indicating STATUS_SUCCESS.

For additional troubleshooting steps during authentication, see Authentication.

Troubleshooting Authentication

Verify that authentication is working correctly by checking for Time skew, UDP Fragmentation or an Invalid Kerberos Realm.

  • Time skew can be verified by running net time /querysntp and net time /setsntp:<PDCe server name>. The /querysntp switch allows you to determine if a specific DC is manually configured as the authoritative time server. The /setsntp:<PDCe server name> switch can be used to synchronize the computer receiving the error with the PDC emulator. The PDC emulator is the authoritative time server by default.
  • UDP fragmentation can cause replication errors that appear to have a source of RPC server is unavailable. Symptoms of UDP fragmentation being at the root of this problem include clients being unable to log on to the domain, administrators being unable join computers to the domain and Event ID 40960 & 40961 errors with a source of LSASRV and Kerberos errors with an Event ID of 10 in the system log.Knowledge base article 244474 – “How to force Kerberos to use TCP instead of UDP in Windows Server 2003, in Microsoft Windows and XP, and in Microsoft Windows 2000” provides the steps to resolve this problem.
  • An incorrect Kerberos realm can also be at the root of RPC server is unavailable problems. The symptoms that will be experience when the Kerberos realm is incorrect include the following errors when opening AD management tools:Naming Convention could not be located because: No authority could be contacted for authentication. Contact your system administrator to verify that your domain is properly configured and is currently online.-or-

    Naming information cannot be located because: No authority could be contacted for authentication. Contact your system administrator to verify that your domain is properly configured and is currently online.

    To verify that the correct Kerberos realm is configured, follow the steps in 837513 – “Domain controller is not functioning correctly”.

Active Directory Symptoms:

1. If you are experiencing replication problems and getting RPC server is unavailable errors as is reported in repadmin /showreps below, use Portqry or Network Monitor to determine if RPC traffic is being blocked is the first step when attempting to troubleshoot RPC Server is unavailable errors.

[Replications Check,DC2] A recent replication attempt failed:
From DC1 to DC2
Naming Context: CN=Schema,CN=Configuration,DC=xl
The replication generated an error (1722):
The RPC server is unavailable.
The failure occurred at 2003-10-30 11:59.47.
The last success occurred at 2003-10-28 20:50.22.
26 failures have occurred since the last success.
[DC1] DsBind() failed with error 1722,
The RPC server is unavailable..
The source remains down. Please check the machine.
BermudaDC1 via RPC objectGuid: 28c78c72-3c95-499a-bcda137a250f069f
Last attempt @ 2003-10-30 11:58.15 failed, result 1722:
The RPC server is unavailable.

Troubleshooting:
If IP Security Policies in Active Directory had the Assigned Value to Server (Request Security) set to Yes then these errors will result. Knowledge base article 313190 – “How to use IPSec IP filter lists in Windows 2000” provide details about where to check these settings and more information about their impact.

2. If you are blocking all ICMP traffic between separate AD sites, you will receive the errors below in the output of DCDIAG when trying to replicate inter-site:

Testing server: contosoDC1
Starting test: Replications
* Replications Check
[Replications Check,DC1] A recent replication attempt failed:
From DC2 to DC1
Naming Context: CN=Schema,CN=Configuration,DC=litware,DC=com
The replication generated an error (1722):
The RPC server is unavailable.
The failure occurred at 2003-08-24 23:00.51.
The last success occurred at (never).
553 failures have occurred since the last success.
[DC2] DsBind() failed with error 1722,
The RPC server is unavailable..
The source remains down. Please check the machine.
REPLICATION LATENCY WARNING
DC1: A full synchronization is in progress
from DC2 to DC1
Replication of new changes along this path will be delayed.
[DC2] LDAP connection failed with error 58,
The specified server cannot perform the requested operation.

Troubleshooting: To resolve this issue, remove the ICMP traffic restriction between domain controllers. When establishing an RPC session prior to AD replication, ICMP traffic is used. If the ICMP fails, so does the RPC session establishment, and hence AD replication also fails. ISA 2004 can prevent ICMP traffic with the exception of computers specified in the Remote Management Computers computer set which can be configured in system policy.

3. The following error will appear when attempting to connect to the computer.

“computer <\servername.domain.local> cannot be managed. The network path was not found. RPC server is unavailable.

Or when viewing the properties of the remote computer you will receive the error:

“Win32: The RPC server is unavailable”.


Troubleshooting:
Computer management is one of the better tools for testing RPC connectivity. When RPC traffic is being blocked, connections to other computers using the computer management console will fail.

4. When attempting to promote an additional domain controller in an Active Directory domain while the RPC service is blocked or not running, the following error will appear:

“The domain “domain.local” is not an Active Directory domain, or an Active Directory domain controller for the domain could not be contacted.


Troubleshooting:

5. Connections to computers via Remote Desktop may fail if RPC connectivity cannot be established. When attempting to logon on to the domain via Remote Desktop the following error will be produced in the form of a popup error message if RPC connectivity is the root of the problem:

“The system cannot log you on due to the following error: The RPC server is unavailable.”

You may also see the following errors on the Terminal server:

Error 1727: The remote procedure call failed and did not execute
Error 1722: The RPC server is unavailable.
Error 1723: The RPC server is too busy to complete this operation.
Error 1721: Not enough resources are available to complete this operation.

-or-

Event ID 5719:
Source: NetLogon
Description: No Windows NT Domain Controller is available for domain domain_name.
The following error occurred: There are currently no logon servers available to
service the logon request.

Event ID: 1219
Source: Winlogon
Details: Logon rejected for CONTOSO<computername>. Unable to obtain Terminal Server
User
Configuration. Error: The RPC server is unavailable.

Troubleshooting: These errors can be a result of the TCP/IP NetBIOS Helper service being disabled on the Terminal server or NetBIOS over TCP/IP being disabled on one of the NIC’s used to access the Terminal server. You should also verify that the Client for Microsoft networks is bound to the adapter used to access the Terminal server. You can tell if this is happening by looking at a Netdiag /v from the box for the following output:

Testing redirector and browser… Failed

NetBT transports test. . . . . . . : Failed
List of NetBt transports currently configured:
[FATAL] No NetBt transports are configured.

Redir and Browser test . . . . . . : Failed
List of transports currently bound to the Redir
NetBIOSSmb
[FATAL] The redir isn’t bound to any NetBt transports.

List of transports currently bound to the browser
[FATAL] The browser isn’t bound to any NetBt transports.

Troubleshooting Tools and Methods

Methods to generate RPC Traffic

Computer Management MMC to a remote host

Outlook to an Exchange server

RPCPing – http://support.microsoft.com/kb/831051

Tools for Testing RPC

RPCPing – http://support.microsoft.com/kb/831051

PortQry – http://support.microsoft.com/default.aspx?scid=kb;EN-US;832919

Pipelist – http://technet.microsoft.com/en-us/sysinternals/dd581625.aspx

RPCDump – http://support.microsoft.com/default.aspx?scid=kb;EN-US;325930

NSLookup – http://support.microsoft.com/default.aspx?scid=kb;EN-US;200525

NBLookup – http://support.microsoft.com/default.aspx?scid=kb;EN-US;830578

Tools for monitoring RPC

Network Monitor – Download FAQ

Wireshark – Download

Using PortQry

You can use the Portqry tool to verify that the required ports are open. You should run the Portqry tool on a computer that is not receiving any RPC errors against a computer that is receiving RPC errors by using the -n switch. To this, follow these steps:

a. Click “Start”, click “Run”, type “cmd” in the “Open” box, and then click OK”.

b. Type “portqry -n <problem_server> -e 135” (without the quotation marks).

The output will appear similar to the following examples:

Querying target system called:

<problem_server>
Attempting to resolve name to IP address…
Name resolved to 169.254.1.1
querying…
<problem_server>
TCP port 135 (epmap service): LISTENING
Using ephemeral source port
Querying Endpoint Mapper Database…

Server’s response:

UUID: f5cc59b4-4264-101a-8c59-08002b2f8426 NtFrs Service
ncacn_ip_tcp:65.53.63.16[1094]
UUID: e3514235-4b06-11d1-ab04-00c04fc2dcd2 MS NT Directory DRS Interface
ncacn_ip_tcp:65.53.63.16[1025]
UUID: e3514235-4b06-11d1-ab04-00c04fc2dcd2 MS NT Directory DRS Interface
ncacn_http:65.53.63.16[1029]
UUID: e3514235-4b06-11d1-ab04-00c04fc2dcd2 MS NT Directory DRS Interface
ncacn_http:65.53.63.16[6004]

If port 135 is blocked, the following will appear:

TCP port 135 (epmap service): NOT LISTENING However, for these RPC Endpoint Mapper errors it is likely that ports greater than 1024 are blocked, and not port 135.From the output, you know the DC is using port 1094 for FRS and 1025, 1029, and 6004 for Active Directory replication. You can use the Portqry tool again to check those ports. For example, you can test all the ports at the same time by using the Portqry tool with the -o switch. For example, type

“portqry -n <problem_server> -o 1094,1025,1029,6004″(Without the quotation marks)

If the ports all respond as “LISTENING,” it’s likely that blocked ports are not causing this problem. If any ports respond as “NOT LISTENING,” the ports are probably blocked.

Resources

RPC Blogs

Basics of RPC are covered here:

RPC to Go v.1: http://blogs.technet.com/b/networking/archive/2008/10/24/rpc-to-go-v-1.aspx

Architecture and a closer look at a connection to the RPC Endpoint mapper in a network capture.

RPC to Go v.2: http://blogs.technet.com/b/networking/archive/2008/12/04/rpc-to-go-v-2.aspx

This describes how RPC commands can be sent over Named Pipes in SMB via the IPC$ Tree.

RPC to Go v.3: http://blogs.technet.com/b/networking/archive/2009/04/28/rpc-to-go-v-3-named-pipes.aspx

Troubleshooting “RPC server is unavailable” error, reported in failing AD replication scenario.

http://blogs.technet.com/b/abizerh/archive/2009/06/11/troubleshooting-rpc-server-is-unavailable-error-reported-in-failing-ad-replication-scenario.aspx

External TechNet Magazine article

This one is good. It lays out RPC basics really quickly and then moves on RPC errors. The information on MaxUserPort would need to be updated with the information about the dynamic port ranges that are used in Vista/W2008 are the high range of ports compared to the 1025-5000 for W2003.

How IT Works, Troubleshooting RPC Errors by Zubair Alexander:

http://technet.microsoft.com/en-us/magazine/2007.07.howitworks.aspxKB

KB Article

Troubleshooting RPC Endpoint Mapper errors using the Windows Server 2003 Support Tools from the product CD

http://support.microsoft.com/default.aspx?scid=kb%3bEN-US%3b839880

 

PowerShell – how to test URL ?

Powershell 101

$
0
0

The aim of this post is to explain some basic tips and tricks about the usage of powershell in a real world:

For reference to well-known PowerShell web sites, go to my Web links on this web site or here is a reference for powershell cmdlets: http://ss64.com/ps/

else in French a simple tutorial:http://lavalisedutechnicien.free.fr/joomla/index.php?option=com_content&view=article&id=195&Itemid=297

Videos:

https://channel9.msdn.com/Blogs/Taste-of-Premier/PowerShellBasicsPart1

https://channel9.msdn.com/Blogs/Taste-of-Premier/PowerShell-Basics-Part-2-Real-Word-Examples-for-Our-Most-Common-Cmdlets

https://channel9.msdn.com/Blogs/Taste-of-Premier/PowerShell-Basics-Part-3-Real-Word-Script-Examples

https://channel9.msdn.com/Blogs/Taste-of-Premier/Whats-New-in-PowerShell-v5

 

0-to retrieve the version and language of powershell:

$host.version

$PSCulture    or Get-Culture

1- create powershell profiles:

get-help about_profiles   ,  get-help about_*

the two well-known profiles are:

  • $profile        ; to display the path of the current user’s (Current User; Current Host)

NCEDALBERA3\C:\Windows\system32> $profile
C:\Users\jdalbera\My DATA\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

  • $pshome ;  to display the path of the main profile.ps1 (All Users;All Hosts)

NCEDALBERA3\C:\Windows\system32> $pshome
C:\Windows\System32\WindowsPowerShell\v1.0

if there is no profile.ps1 create it !

NCEDALBERA3\C:\Windows\system32> cd C:\Windows\System32\WindowsPowerShell\v1.0
NCEDALBERA3\C:\Windows\System32\WindowsPowerShell\v1.0> dir *.ps1
Répertoire : C:\Windows\System32\WindowsPowerShell\v1.0

Mode                LastWriteTime     Length Name
—-                ————-     —— —-
-a—        04/11/2012     23:13        802 Microsoft.PowerShellISE_profile.ps1
-a—        13/03/2014     22:53       1774 profile.ps1

  • Microsoft.PowerShellISE_profile.ps1  ; correspond to the powershell profile read when ISE is started

 

2- import the modules on profiles (for Windows server):

servermanager, activedirectory

to list the modules available: get-module -list  or get-installedmodules

3- verify the variables (variables psdrive)

get-psdrives  ; to list all available PSdrives

dir variables:

and modify the error;debug… accordingly

4- Powershell help:

PS v3: be careful with the get-help command. http://www.silogix.fr/blog-silogix/powershell-v3-du-nouveau-dans-laide.aspx

– use/read intensively the equivalent of well-knows MAN pages on Unix world, called here, get-help and get-help about_*

– get-help <cmdlet> -examples|-full|-detailed

– <cmdlet> | get-member  ;  to list the cmdlet properties and methods

– get-command -module <modulename>

– get-command *module

– get-command | where-object { $_.definition -like “*-new*”}  ; display all the cmdlets containing -newest as parameter

– get-command | where-object { $_.definition -like “*computername*”}  ; display all the cmdlets containing “computername” as parameter

– get-module -listavailable

– get-alias                ; list all the aliases

– <cmdlet> | fl prop1,*prop2… or | ft -autosize

5- On powershell scripts:

– create functions and modules; function(){}

– use try/catch/finally, to trap errors

– use -ErrorActivation or -ErrorVariable for each cmdlet

– use the foreach-object {} cmdlet

– use the import-CSV, export-CSV, exportto-XML, out-file

– use intensively: where-object {} cmdlet

– use intensively: tee-object -filepath|-variable

– use intensively arrays: get-help about_arrays, about_hash_tables

– WMI support: get-wmiobject cmdlet

5- Examples of well-known cmdlets:

– to restart a computer without be prompted: restart-computer

– get-childitem -path c:\users -recurse -include *.txt

– to rename files in bulk mode: get-ChildItem -Filter “*current*” -Recurse | Rename-Item -NewName {$_.name -replace ‘current’,’old’ }

– to rename image files in bulk mode: Get-ChildItem -Filter *.jpg | %{ Rename-Item $_.FullName ($_.Name.split(“.”)[0].Substring(3)+”.jpg”)}

– get-service | format-list  ; get-service | get-member |out-gridview

– get-process | format-wide

6- How to remove string in a variable:

PS C:\WINDOWS\system32> $grp = “o365grp-my group-jda”

PS C:\WINDOWS\system32> $res = $grp -creplace ‘^o365grp-‘,”
PS C:\WINDOWS\system32> $res
my group-jda

7- How to install AzureAD and MSOnline modules:

Get-InstalledModule -Name “AzureAD*”

To uninstall a previous version of AzureADPreview or AzureAD, run this command:
Uninstall-Module AzureADPreview
or
Uninstall-Module AzureAD

To install the latest version of AzureADPreview, run this command:   Install-Module AzureADPreview -Force

To install MSOnline run: Install-Module Msonline -Force

8– Parsing text with powershell:

https://devblogs.microsoft.com/powershell/parsing-text-with-powershell-1-3/

https://devblogs.microsoft.com/powershell/parsing-text-with-powershell-2-3/

https://devblogs.microsoft.com/powershell/parsing-text-with-powershell-3-3/

 

Azure Cloud shell

$
0
0

Overview:

https://docs.microsoft.com/en-us/azure/cloud-shell/overview

URL: https://shell.azure.com

On first launch Cloud Shell prompts to create a resource group, storage account, and Azure Files share on your behalf. This is a one-time step and will be automatically attached for all sessions. A single file share can be mapped and will be used by both Bash and PowerShell in Cloud Shell.

Read more to learn how to mount a new or existing storage account.

  • Cloud Shell runs on a temporary host provided on a per-session, per-user basis
  • Cloud Shell times out after 20 minutes without interactive activity
  • Cloud Shell requires an Azure file share to be mounted
  • Cloud Shell uses the same Azure file share for both Bash and PowerShell
  • Cloud Shell is assigned one machine per user account
  • Cloud Shell persists $HOME using a 5-GB image held in your file share
  • Permissions are set as a regular Linux user in Bash

Learn more about features in Bash in Cloud Shell and PowerShell in Cloud Shell.

Azure cloud shell limitations:

https://docs.microsoft.com/en-us/azure/cloud-shell/limitations

Troubleshooting:

https://docs.microsoft.com/en-us/azure/cloud-shell/troubleshooting

 

How to access Azure cloud shell from Visual Studio Code ?

http://espacenuagic.com/2018/08/17/utiliser-azure-cloud-shell-depuis-visual-studio-code/

On a windows computer

Install VS code: https://code.visualstudio.com/download

then install NodeJS: https://nodejs.org/en/

then on VS Code install the extension “Azure Account

 

 

Viewing all 85 articles
Browse latest View live