Getting List of Hosts on Network via Terminal
Is there a way to scan the network and report back a list of network servers?
I specifically need Samba servers, but it would be great to find all servers, including the UPnP servers on the network.
I read up on smbclient but it seems you need to know the host name/ip beforehand when using that command.
TIA!
You could also ping your broadcast address then look at your arp table (remove the n option to lookup host names):
<pre style="border: 1px solid #ddd; padding-left: .75ex; padding-top: .25em; padding-bottom: .25em; margin-top: .5em; margin-bottom: .5em; margin-left: 1ex; max-width: 80ex; overflow: auto; font-size: 10px; font-family: Monaco, 'Courier New', Courier, monospace; color: #444; background: #eee; line-height: normal">ping -c2 `ifconfig | awk '/broadcast/{print $NF; exit}'` 2>&1 >/dev/null; arp -na</pre>
Similar Messages
-
Adhoc network created in windows 8.1 gets listed as an infrastructure network
Hi All,
I have created a adhoc network on a windows 8.1 (home ) tab following the below steps ,
netsh wlan set hostednetwork mode=allow
netsh wlan set hostednetwork ssid=tests key=123456789
netsh wlan start hostednetwork
hosted network started but to my surprise it got listed in all the other windows 8.1 tabs (which was not supposed to be listed),
I ran netsh wlan show networks command only to see that the new adhoc network <tests> is being detected by all other tabs as Infrastructure network
Did I miss anything while creating the network ? cuz.. I was expecting it to be listed as "adhoc" network ?
Other part of the deal is when I try to connect another 8.1 tab (home edition) by following the below steps
Click Open Network and Sharing Center > Manage Wireless Networks >
Add.
Click "Manually create a network profile". (This may look silly but we really are going to create an infrastructure network now.)
Enter the network name (SSID), security type, encryption type (if any) and the key that you noted in step 1.
Uncheck both checkboxes ("Start this connection automatically" and "Connect even if the network is not broadcasting".) [Note that you cannot have the connection start automatically. If you try to have it checked, step 10 will fail. A
different way to start it automatically during system boot is described below.]
Click Next > Close. Your connection must appear in the list with the icon suggesting infrastructure (two big screens connected to a tube). Don't worry about it.
Click Start, type in "cmd" in the search box, press Enter.
In the Command Prompt, type in "netsh wlan set profileparameter name=NetworkName
ConnectionType=IBSS", exactly as shown, without quotes, except you must substitute
NetworkName with the SSID (network name) of your ad-hoc network
connection fails (if I change the connection type back to ESS , it gets successfully connected
Why is this ? I am struggling with this from yesterday..Hi,
According to your description, it seems that your all Windows 8.1 computers connect to network via normal wireless network.
Did you have wireless router for them?
Please delete this adhoc, then check if these computer could connect to network.
If no, follow below guide to create and connect to adhoc :
Create adhoc in Windows 8.1
http://tipsandtricksforum.com/thread-210.html
connect to adhoc with Windows 8.1
http://social.technet.microsoft.com/Forums/windows/en-US/56ff83ff-1f15-4fc1-aa37-6651340d46fa/windows-81-connecting-to-ad-hoc-networks
Please Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
Karen Hu
TechNet Community Support -
Connect Airport Network via Terminal
In 10.5, using the following command:
/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -A'yourSSID' password
would connect you to the 'yourSSID' network with password of 'password'.
In 10.6, it seems like the -A (attach) switch has been removed from the 'airport' command.
Does anyone know how to associate a 10.6 Mac with a wireless network via the command line?networksetup -addpreferredwirelessnetworkatindex Airport $SSID 0 WEP $SSIDPWD
-
Did a clean install 10.9.4. on a Apple Stock 1TB Fusion Hard Drive. When I run "diskutil list" via Terminal, everything is wrong. I have "EFI" and "apple Boot Boot OSX" in every dev/disk** Everything is out of place, How can I repair? Im willing too reformat if need be, however thats what I did in the first place. Any help would be much appreciated, thank you.
I know this cannot be correct
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *121.3 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage 121.0 GB disk0s2
3: Apple_Boot Boot OS X 134.2 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk1
1: EFI EFI 209.7 MB disk1s1
2: Apple_CoreStorage 999.3 GB disk1s2
3: Apple_Boot Boot OS X 650.0 MB disk1s3
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS Fusion *1.1 TB disk2
/dev/disk7
#: TYPE NAME SIZE IDENTIFIER
0: *121.9 GB disk7It appears as if my startup disk has been reversed and not using the fusion ssd portion as it should. At least its now reversed as to what it used to be originally before. the 128gb ssd used to be on top. Is my mac booting fusion correctly? Thank you for responding as I was about to reformat.
CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group C2619AFE-0EB5-4721-8C50-3F3DBA520D1B
=========================================================
Name: fusion
Status: Online
Size: 1120333979648 B (1.1 TB)
Free Space: 114688 B (114.7 KB)
|
+-< Physical Volume 583AAEA9-E333-4A83-9BE3-E937396E9248
| ----------------------------------------------------
| Index: 0
| Disk: disk0s2
| Status: Online
| Size: 120988852224 B (121.0 GB)
|
+-< Physical Volume B0C1CB16-D46F-4387-A679-B55392BB7934
| ----------------------------------------------------
| Index: 1
| Disk: disk1s2
| Status: Online
| Size: 999345127424 B (999.3 GB)
|
+-> Logical Volume Family FB42B9F4-CB77-4162-831B-7DCB7816E760
Encryption Status: Unlocked
Encryption Type: None
Conversion Status: NoConversion
Conversion Direction: -none-
Has Encrypted Extents: No
Fully Secure: No
Passphrase Required: No
|
+-> Logical Volume C0B8479B-C51C-45BF-B59B-1AA5DF3A3B83
Disk: disk2
Status: Online
Size (Total): 1111826497536 B (1.1 TB)
Conversion Progress: -none-
Revertible: No
LV Name: Fusion
Volume Name: Fusion
Content Hint: Apple_HFS
FoHeazys-Mac-mini:~ FoHeazy$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *121.3 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage 121.0 GB disk0s2
3: Apple_Boot Boot OS X 134.2 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk1
1: EFI EFI 209.7 MB disk1s1
2: Apple_CoreStorage 999.3 GB disk1s2
3: Apple_Boot Boot OS X 650.0 MB disk1s3
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS Fusion *1.1 TB disk2 -
I am new to Mac...How do I get connected to a server on my network via a hyper link IP address path? When I try to open in a URL and login as a registered user with proper login it errors out saying there was a problem with connecting to the server?
Some of the following is going to use some technical terms — this area is inherently somewhat technical.
If you don't understand some part of the following reply, please ask.
Is this your own OS X Server system on your own network, or is this some other server within some larger organization?
You're posting this in the OS X Server forum, which is a software package that allows OS X systems to provide web-based and many other services; to become servers.
If it's your OS X Server on your network, then the network and DNS configurations are suspect, or the server is somehow malfunctioning or misconfigured. This is unfortunately fairly common, as some folks do try to avoid setting up DNS services.
If it's a larger organization and somebody else is managing the server and the network, then you'll probably need to contact the IT folks for assistance; to learn the network setup and DNS requirements, and if there's a problem with the server itself.
The basic web URL "hyper link IP address path" — without using DNS — usually looks something the following, where you'll need to replace 10.20.30.40 with the IP address of your server:
http://10.20.30.40
UptimeJeff has posted a URL that specifies the AFP file system; an OS X file share. That's used if you're connecting to an Apple storage service somewhere on your network. You might alternatively need to specify smb://10.20.30.40 or such, if it's a Windows file server. (There can be additional requirements for connecting to Windows Server systems, too.)
If there's local IT staff available here, please contact them for assistance. If these are your own local systems and your own local OS X Server system, then some information on the server will be needed. (If you're on a NAT'd network, you'll also need to get DNS services configured and working on your local OS X Server system and your network — you'll not be able to skip this step and reference ISP DNS servers here — or things can and usually will get weird.) -
[solved] problem getting vbox host only networking going on arch host
New arch user here, been running for 2-3 weeks. Finally came across something I can't wiki/google my way through, trying to get host only networking going.
So.... I started by trying the graphical virtualbox manager. File -> preferences -> network -> add, which gives:
Failed to create the host-only network interface.
Callee RC: NS_ERROR_ABORT (0x80004004)
Tried the following also, with no luck:
> VBoxManage hostonlyif create
VBoxManage: error: Code NS_ERROR_ABORT (0x80004004) - Operation aborted (extended info not available)
Context: "CreateHostOnlyNetworkInterface (hif.asOutParam(), progress.asOutParam())" at line 64 of file VBoxManageHostonly.cpp
Segmentation fault
> VBoxManage dhcpserver add --ifname hth0 --ip 10.1.1.1 --netmask 255.255.255.0 --lowerip 10.1.1.10 --upperip 10.1.1.20 --enable
VBoxManage: error: The host network interface with the given name could not be found
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component Host, interface IHost, callee nsISupports
Context: "FindHostNetworkInterfaceByName(Bstr(pIfName).mutableRaw(), hif.asOutParam())" at line 225 of file VBoxManageDHCPServer.cpp
VBoxManage: error: Could not find interface 'hth0'
> uname -a
Linux bing 3.1.1-1-ARCH #1 SMP PREEMPT Fri Nov 11 22:28:29 CET 2011 x86_64 AMD E-350 Processor AuthenticAMD GNU/Linux
> lsmod | grep vbox
vboxnetflt 17159 0
vboxdrv 1790690 1 vboxnetflt
> pacman -Q virtualbox
virtualbox 4.1.6-3
I also have extension pack 4.1.6r74713 if that matters.
edit: code tags
Last edited by nht (2011-11-19 16:37:49)Thank you sir, that's exactly what I needed.
Now that I look, I see mention of this in the VirtualBox Extras section of the wiki, but not the VirtualBox or Advanced VirtualBox Networking sections. I have edited the Advanced VirtualBox Networking wiki to add mention of this.
Last edited by nht (2011-11-19 17:18:28) -
REST url to get titles and description for all the lists in HOST WEB.
What should be the REST url to get specific prperties for all the list in host web for SharePoint Hosted Apps.
Hi,
We can use the REST URI below:
http://myAppweburl/_api/web/lists?$select=Title,Description
More information:
How to: Complete basic operations using SharePoint 2013 REST endpoints
http://msdn.microsoft.com/en-us/library/office/jj164022(v=office.15).aspx
Best Regards
Dennis Guo
TechNet Community Support -
Trying to get my Viera TX-P42S30B hooked up to my home network via Airport express with no luck.
Have tried both wired (network cable) and wireless to no avail, can't find much info online, any help appreciated !
Airport utility 5.5.3
Airport Extreme 802.11n
Airport Express 802.11gThe problem is that the AirPort Express (AX) is creating a subnet.
To prevent that, configure the AX to act as a bridge (so that it is NOT sharing a single IP address). -
How to assign Static IP via Terminal in Mountain Lion OSX?
I have formatted by Macbook Pro 13 inch (2009 Oct) running on Mountain Lion OSX. I am trying to install the OSX via Ethernet at office network but I am unable to do so due to network restrictions. Macbook Pro picks the IP automatically when connected over Ethernet.
In order to install the OSX over the same network I have to configure the Macbook to static IP (public netowork). Could you please guide me how to configure Static IP via Terminal? I mean the commands to feed in Terminal. Thanks!First get a list of your network services:
networksetup -listallnetworkservices
Then use the desired service name in the following command:
networksetup -setmanual SERVICE IP SUBNET ROUTER
For example, by default the Wi-Fi connection will be called "Wi-Fi," so you can use the following to set it to a classic private IP address:
networksetup -setmanual Wi-Fi 192.168.1.2 255.255.255.0 192.168.1.1
To set it back to DHCP, use the following command:
networksetup -setdhcp SERVICE
To keep DHCP services but only use a manually designated IP address, then use the following command:
networksetup -setmanualwithdhcprouter SERVICE IP
You may need to preceede these commands with "sudo" (followed by a single space) to run them with administrative privileges. -
Get List running all the time in Yosemite
For the last two days I have had a gear spinning in Yosemite menu bar performing a function named Get List. What is going on?
I reran Etrecheck today while the getlist script was running to see if anything else might appear. Also, I uninstalled CleanMyMac. Here are the results:
EtreCheck version: 2.1.5 (108)
Report generated December 18, 2014 at 07:42:11 EST
Click the [Support] links for help with non-Apple products.
Click the [Details] links for more information about that line.
Click the [Adware] links for help removing adware.
Hardware Information: ℹ️
iMac (27-inch, Late 2013) (Verified)
iMac - model: iMac14,2
1 3.5 GHz Intel Core i7 CPU: 4-core
32 GB RAM Upgradeable
BANK 0/DIMM0
8 GB DDR3 1600 MHz ok
BANK 1/DIMM0
8 GB DDR3 1600 MHz ok
BANK 0/DIMM1
8 GB DDR3 1600 MHz ok
BANK 1/DIMM1
8 GB DDR3 1600 MHz ok
Bluetooth: Good - Handoff/Airdrop2 supported
Wireless: en1: 802.11 a/b/g/n/ac
Video Information: ℹ️
NVIDIA GeForce GTX 780M - VRAM: 4096 MB
iMac 2560 x 1440
System Software: ℹ️
OS X 10.10.1 (14B25) - Uptime: one day 15:50:19
Disk Information: ℹ️
APPLE HDD ST1000DM003 disk0 : (1 TB)
EFI (disk0s1) <not mounted> : 210 MB
Macintosh HD (disk0s2) / : 999.35 GB (752.72 GB free)
Recovery HD (disk0s3) <not mounted> [Recovery]: 650 MB
USB Information: ℹ️
Apple Inc. FaceTime HD Camera (Built-in)
Apple Inc. BRCM20702 Hub
Apple Inc. Bluetooth USB Host Controller
Hewlett-Packard HP Color LaserJet CM1017
Thunderbolt Information: ℹ️
Apple Inc. thunderbolt_bus
Gatekeeper: ℹ️
Mac App Store and identified developers
Kernel Extensions: ℹ️
/System/Library/Extensions
[loaded] com.Cycling74.driver.Soundflower (1.6.6 - SDK 10.6) [Support]
[not loaded] com.hField.WiFire.ZD1215 (1.0.14) [Support]
[loaded] com.logmein.driver.LogMeInSoundDriver (1.0.3 - SDK 10.5) [Support]
[not loaded] com.markspace.iokit.IOMissingSyncMassStorage (199) [Support]
[not loaded] com.markspace.missingsync.palmos.classicseize (1) [Support]
[not loaded] com.palm.ClassicNotSeizeDriver (3.2.1) [Support]
[not loaded] com.rim.driver.BlackBerryUSBDriverInt (0.0.39) [Support]
[not loaded] com.rim.driver.BlackBerryUSBDriverVSP (0.0.39) [Support]
Startup Items: ℹ️
HP USB EWS Gateway: Path: /Library/StartupItems/HP USB EWS Gateway
MissingSyncMounting: Path: /Library/StartupItems/MissingSyncMounting
ParallelsTransporter: Path: /Library/StartupItems/ParallelsTransporter
Startup items are obsolete in OS X Yosemite
Launch Agents: ℹ️
[loaded] com.hp.help.tocgenerator.plist [Support]
[running] com.hp.productresearch.plist [Support]
[loaded] com.oracle.java.Java-Updater.plist [Support]
[running] com.rim.BBLaunchAgent.plist [Support]
Launch Daemons: ℹ️
[failed] com.adobe.fpsaud.plist [Support]
[loaded] com.adobe.versioncueCS3.plist [Support]
[running] com.hfield.WiFireAgent.plist [Support]
[loaded] com.microsoft.office.licensing.helper.plist [Support]
[loaded] com.oracle.java.Helper-Tool.plist [Support]
[loaded] com.oracle.java.JavaUpdateHelper.plist [Support]
[running] com.rim.BBDaemon.plist [Support]
User Launch Agents: ℹ️
[running] .dat0939.000 (hidden) [Support]
/System/Library/CoreServices/Folder Actions Dispatcher.app/Contents/MacOS/Folder Actions Dispatcher /System/Library/CoreServices/Folder Actions Dispatcher.app/Contents/MacOS/Folder Actions Dispatcher
[invalid?] .dat1a10.000 (hidden) [Support]
[loaded] com.adobe.ARM.[...].plist [Support]
[loaded] com.facebook.videochat.[redacted].plist [Support]
[loaded] com.google.keystone.agent.plist [Support]
[not loaded] com.iLike.Agent.plist [Support]
[loaded] com.logos.LogosIndexer.plist [Support]
[running] com.microsoft.LaunchAgent.SyncServicesAgent.plist [Support]
[running] ws.agile.1PasswordAgent.plist [Support]
User Login Items: ℹ️
AirPort Base Station Agent Application (/System/Library/CoreServices/AirPort Base Station Agent.app)
Backup Scheduler for Time Machine Application (/Applications/Time Machine Backup Scheduler.app)
AdobeResourceSynchronizer Application (/Applications/Adobe Acrobat 8 Professional/Adobe Acrobat Professional.app/Contents/Support/AdobeResourceSynchronizer.app)
Printer Pro Desktop Application (/Applications/Printer Pro Desktop.app)
Internet Plug-ins: ℹ️
DirectorShockwave: Version: 11.0.3r470 [Support]
Default Browser: Version: 600 - SDK 10.10
Flip4Mac WMV Plugin: Version: 3.2.0.16 - SDK 10.8 [Support]
Musicnotes: Version: 1.17.2 [Support]
OfficeLiveBrowserPlugin: Version: 12.3.5 [Support]
AdobePDFViewerNPAPI: Version: 11.0.09 - SDK 10.6 [Support]
FlashPlayer-10.6: Version: 16.0.0.235 - SDK 10.6 [Support]
Silverlight: Version: 4.0.60129.0 [Support]
Flash Player: Version: 16.0.0.235 - SDK 10.6 [Support]
iPhotoPhotocast: Version: 7.0 - SDK 10.8
QuickTime Plugin: Version: 7.7.3
SharePointBrowserPlugin: Version: 14.4.6 - SDK 10.6 [Support]
AdobePDFViewer: Version: 8.0.0 [Support]
NPExView: Version: Unknown [Support]
JavaAppletPlugin: Version: Java 8 Update 25 Check version
User internet Plug-ins: ℹ️
fbplugin_1_0_1: Version: Unknown [Support]
fbplugin_1_0_3: Version: Unknown [Support]
Safari Extensions: ℹ️
1Password [Installed]
OpenIE [Installed]
User iTunes Plug-ins: ℹ️
Flash Player: Version: 9.0.159.0 Mismatch! Adobe recommends 16.0.0.235
3rd Party Preference Panes: ℹ️
3ivx MPEG-4 [Support]
Adobe Version Cue CS3 [Support]
Citrix ShareFile Sync [Support]
Flash Player [Support]
Flip4Mac WMV [Support]
Java [Support]
Time Machine: ℹ️
Skip System Files: NO
Mobile backups: OFF
Auto backup: NO - Auto backup turned off
Volumes being backed up:
Macintosh HD: Disk size: 999.35 GB Disk used: 246.62 GB
Destinations:
Data [Network]
Total size: 2.00 TB
Total number of backups: 3
Oldest backup: 2014-09-30 07:50:32 +0000
Last backup: 2014-10-02 13:38:07 +0000
Size of backup disk: Adequate
Backup size 2.00 TB > (Disk used 246.62 GB X 3)
Top Processes by CPU: ℹ️
8% WindowServer
2% Finder
2% ScriptMonitor
1% Microsoft Outlook
0% fontd
Top Processes by Memory: ℹ️
996 MB firefox
275 MB mds_stores
206 MB softwareupdated
172 MB WindowServer
103 MB mds
Virtual Memory Information: ℹ️
26.59 GB Free RAM
3.68 GB Active RAM
2.16 GB Inactive RAM
1.91 GB Wired RAM
6.32 GB Page-ins
0 B Page-outs
Diagnostics Information: ℹ️
Dec 17, 2014, 03:08:33 PM /Users/[redacted]/Library/Logs/DiagnosticReports/InkWidgetTool_2014-12-17-15083 3_[redacted].crash
Dec 17, 2014, 03:08:23 PM /Users/[redacted]/Library/Logs/DiagnosticReports/InkWidgetTool_2014-12-17-15082 3_[redacted].crash
Dec 17, 2014, 08:02:20 AM /Library/Logs/DiagnosticReports/DesktopServicesHelper_2014-12-17-080220_[redact ed].cpu_resource.diag [Details]
Dec 17, 2014, 12:03:10 AM /Library/Logs/DiagnosticReports/LogosIndexer_2014-12-17-000310_[redacted].cpu_r esource.diag [Details]
Dec 16, 2014, 03:52:27 PM Self test - passed
Dec 16, 2014, 08:50:15 AM /Library/Logs/DiagnosticReports/DesktopServicesHelper_2014-12-16-085015_[redact ed].cpu_resource.diag [Details]
Dec 15, 2014, 10:32:16 PM /Users/[redacted]/Library/Logs/DiagnosticReports/InkWidgetTool_2014-12-15-22321 6_[redacted].crash
Dec 15, 2014, 10:32:06 PM /Users/[redacted]/Library/Logs/DiagnosticReports/InkWidgetTool_2014-12-15-22320 6_[redacted].crash -
How to check folder sizes of the root directory on my VPS/Dedicated server via Terminal?
Hi,
I have following issue.
I have a VPS with Linux OS and I'd like to check size of the folders as well as remaining space on my server.
How can I do that via Terminal?
I would appreciate any input.login into your VPS server via terminal and cd into the root of your hosted space. Then use the df -h command to see the listing
for i.e.
df -h /volumes/volume_1
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
//john@ds00/volume_1 457Gi 12Gi 445Gi 3% 0 18446744073709551615 0% /Volumes/volume_1
for you it would be something like:
df -h [email protected]/share (ip address) -
Hi
I need to know the command for getting list of softwares installed on all the remote systems in network which are existing in their respective registry like HKEY_LOCAL_MACHINE\SOFTWARE of all other systemsHey
Sorry this isn't powershell but it should do the job if you want to use it. The problem with using the Win32_Product WMI Class to enumerate the installed software (especially on Windows 2000 & 2003 Servers) is that the WMI class is NOT installed by default. Here is a VBScript i wrote to read a list of hostnames from a text file named "ComputerNames.txt" from the scripts directory and attempt to remotely enumerate all subkeys within the following registry key
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
For each subkey enumerated it will attempt to read the value of the "DisplayName" key and output the results to a csv file.
(the results should be the same as what you would see when you open Add/Remove Programs)
Hope that helps
Cheers
Matt :)
'Script Name : CheckInstalledSoftware.vbs
'Author : Matthew Beattie
'Created : 01/03/10
'Description : This script reads a list of hostnames from a text file name "ComputerNames.txt" in the scripts working
' : directory. For each hostName it requests an ICMP response and if successfull attempts a remote registry
' : connection to enumerate and read the registry values of installed software. All results are logged to the
' : scripts working directory in a log file per computer name.
'Initialization Section
Option Explicit
Const ForReading = 1
Const ForAppending = 8
Dim objFSO, wshNetwork, wshShell, hostName
Dim scriptBaseName, scriptPath, scriptLogPath
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set wshShell = CreateObject("WScript.Shell")
Set wshNetwork = CreateObject("WScript.Network")
scriptBaseName = objFSO.GetBaseName(Wscript.ScriptFullName)
scriptPath = objFSO.GetFile(Wscript.ScriptFullName).ParentFolder.Path
scriptLogPath = scriptPath & "\" & IsoDateString(Now)
If Err.Number <> 0 Then
Wscript.Quit
End If
On Error Goto 0
'Main Processing Section
On Error Resume Next
PromptStart
ProcessScript
If Err.Number <> 0 Then
Wscript.Quit
End If
PromptEnd
On Error Goto 0
'Functions Processing Section
'Name : ProcessScript -> Primary Function that controls all other script processing.
'Parameters : None ->
'Return : None ->
Function ProcessScript
Dim fileSpec, hostNames, regKey, keyName, results, result
keyName = "DisplayName"
regKey = "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall"
fileSpec = scriptPath & "\ComputerNames.txt"
'Ensure the "ComputerNames.txt" file exists within the scripts working directory.
If Not objFSO.FileExists(fileSpec) Then
MsgBox DQ(fileSpec) & " does not exist!", vbCritical, scriptBaseName
Exit Function
End If
'Read the list of hostNames from the "ComputerNames.txt" text file within the scripts working directory.
If Not GetScriptInput(hostNames, fileSpec) Then
Exit Function
End If
'Attempt to read the registry from each hostname read from the list of hostnames.
For Each hostName In hostNames
Do
'Ensure the system responds to an ICMP request.
If Not CheckConnection(hostName) Then
LogMessage 2, "Failed to respond to an ICMP Request"
Exit Do
End If
'Enumerate and read the registry values.
If Not GetRegValues(results, hostName, keyName, regKey) Then
Exit Do
End If
'Log the registry values results.
For Each result In results
LogMessage 0, result
Next
Loop Until True
Next
End Function
'Name : GetScriptInput -> Reads a text file to be used as Script input.
'Parameters : items -> Output: An array of items in the script input file.
' : fileSpec -> The full folder Path, file Name and extention of the script input file.
'Return : GetScriptInput -> Returns an array of items for script input and True or False.
Function GetScriptInput(items, fileSpec)
Dim scriptInputFile, itemsDict, item
GetScriptInput = False
Set itemsDict = NewDictionary
If Not objFSO.FileExists(fileSpec) Then
Exit Function
End If
On Error Resume Next
Set scriptInputFile = objFSO.OpenTextFile(fileSpec, ForReading)
If Err.Number <> 0 Then
Exit Function
End If
On Error Goto 0
Do Until scriptInputFile.AtEndOfStream
item = scriptInputFile.ReadLine
If item = "" Then
Exit Function
End If
If Not itemsDict.Exists(item) Then
itemsDict.Add item, ""
End If
Loop
items = itemsDict.Keys
GetScriptInput = True
End Function
'Name : CheckConnection -> Checks a remote host using WMI ping.
'Parameters : hostName -> Hostname of computer system to verify network connectivity with.
'Return : Boolean -> True if hostname replies. False otherwise.
Function CheckConnection(hostName)
Dim ping, response, replied
Set ping = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
("select * from Win32_PingStatus where address = '" & hostName & "'")
For each response in ping
replied = Not IsNull(response.StatusCode) And response.StatusCode = 0
Next
CheckConnection = replied
End Function
'Name : GetRegValues -> Enumerates the subkeys in a registry key and the values of the keyName.
'Parameters : hostName -> String containing the hostName of the system to enumerate the registry keys on.
' : keyName -> String containing the name of the registry key value to enumerate.
' : regKey -> Registry key to enumerate subkey names for.
'Return : GetRegValues -> Returns True and an Array containing the registry key values otherwise False.
Function GetRegValues(results, hostName, keyName, regKey)
Dim objReg, regDict, rootKey, hive, keyValue, subKeys, i
GetRegValues = False
rootKey = regKey
hive = GetRegistryHiveFromKey(rootKey)
On Error Resume Next
If hive <> 0 Then
'Create a dictionary object to store the registry values in.
Set regDict = NewDictionary
If Err.Number <> 0 Then
LogMessage 1, "Creating Dictionary Object"
Exit Function
End If
'Connect to the remote registry.
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & hostName & "\root\default:StdRegProv")
If Err.Number <> 0 Then
LogMessage 1, "Creating StdRegProv Object"
Exit Function
End If
'Enumerate the subkey names within the regKey paramater.
objReg.EnumKey hive, rootKey, subKeys
If Err.Number <> 0 Then
LogMessage 1, "Enumerating Registry Keys"
Exit Function
End If
'Ensure the results are an array.
If Not IsArray(subKeys) Then
subKeys = Array(subKeys)
End If
'Read the registry key value for each subkey. Add the results to the dictionary.
For i = 0 to UBound(subKeys)
objReg.GetStringValue hive, rootKey & "\" & subKeys(i), keyName, keyValue
If Err.Number = 0 Then
If Not IsNull(keyValue) Then
regDict(regDict.Count) = keyValue
End If
Else
Err.Clear
End If
Next
End If
On Error Goto 0
results = regDict.Items
GetRegValues = True
End Function
'Name : GetRegistryHiveFromKey -> Get the hive ID from a registry key name.
'Parameters: Input/Output: key -> Registry key name. Hive name will be removed.
'Return : GetRegistryHiveFromKey -> ID of hive of given key name (0 if invalid).
' : -> The hive name is removed from the input key name.
Function GetRegistryHiveFromKey (key)
Dim pos, hive
pos = Instr (key, "\")
If pos = 0 Then
pos = Len(key) + 1
End If
hive = Left (UCase (Left (key, pos - 1)) & " ", 4)
key = Mid (key, pos + 1)
GetRegistryHiveFromKey = Array(0, &H80000000, &H80000001, &H80000002, &H80000003, &H80000005, &H80000006) _
(Int ((Instr("HKCR,HKCU,HKLM,HKU ,HKCC,HKDD", hive) + 4) / 5))
End Function
'Name : NewDictionary -> Creates a new dictionary object.
'Parameters : None ->
'Return : NewDictionary -> Returns a dictionary object.
Function NewDictionary
Dim dict
Set dict = CreateObject("scripting.Dictionary")
dict.CompareMode = vbTextCompare
Set NewDictionary = dict
End Function
'Name : DQ -> Place double quotes around a string and replace double quotes
' : -> within the string with pairs of double quotes.
'Parameters : stringValue -> String value to be double quoted
'Return : DQ -> Double quoted string.
Function DQ (ByVal stringValue)
If stringValue <> "" Then
DQ = """" & Replace (stringValue, """", """""") & """"
Else
DQ = """"""
End If
End Function
'Name : IsoDateTimeString -> Generate an ISO date and time string from a date/time value.
'Parameters : dateValue -> Input date/time value.
'Return : IsoDateTimeString -> Date and time parts of the input value in "yyyy-mm-dd hh:mm:ss" format.
Function IsoDateTimeString(dateValue)
IsoDateTimeString = IsoDateString (dateValue) & " " & IsoTimeString (dateValue)
End Function
'Name : IsoDateString -> Generate an ISO date string from a date/time value.
'Parameters : dateValue -> Input date/time value.
'Return : IsoDateString -> Date part of the input value in "yyyy-mm-dd" format.
Function IsoDateString(dateValue)
If IsDate(dateValue) Then
IsoDateString = Right ("000" & Year (dateValue), 4) & "-" & _
Right ( "0" & Month (dateValue), 2) & "-" & _
Right ( "0" & Day (dateValue), 2)
Else
IsoDateString = "0000-00-00"
End If
End Function
'Name : IsoTimeString -> Generate an ISO time string from a date/time value.
'Parameters : dateValue -> Input date/time value.
'Return : IsoTimeString -> Time part of the input value in "hh:mm:ss" format.
Function IsoTimeString(dateValue)
If IsDate(dateValue) Then
IsoTimeString = Right ("0" & Hour (dateValue), 2) & ":" & _
Right ("0" & Minute (dateValue), 2) & ":" & _
Right ("0" & Second (dateValue), 2)
Else
IsoTimeString = "00:00:00"
End If
End Function
'Name : LogMessage -> Parses a message to the log file based on the messageType.
'Parameters : messageType -> Integer representing the messageType.
' : -> 0 = message (writes to a ".csv" file)
' : -> 1 = error, (writes to a ".err" file including information relating to the error object.)
' : -> 2 = error message (writes to a ".err" file without information relating to the error object.)
' : message -> String containing the message to write to the log file.
'Return : None ->
Function LogMessage(messageType, message)
Dim prefix, logType
prefix = hostName
Select Case messageType
Case 0
logType = "csv"
Case 1
logType = "err"
message = "Error " & Err.Number & " (Hex " & Hex(Err.Number) & ") " & message & ". " & Err.Description
Case Else
LogType = "err"
End Select
If Not LogToCentralFile(scriptLogPath & "." & logType, hostName & "," & message) Then
Exit Function
End If
End Function
'Name : LogToCentralFile -> Attempts to Appends information to a central file.
'Parameters : logSpec -> Folder path, file name and extension of the central log file to append to.
' : message -> String to include in the central log file
'Return : LogToCentralFile -> Returns True if Successfull otherwise False.
Function LogToCentralFile(logSpec, message)
Dim attempts, objLogFile
LogToCentralFile = False
'Attempt to append to the central log file up to 10 times, as it may be locked by some other system.
attempts = 0
On Error Resume Next
Do
Set objLogFile = objFSO.OpenTextFile(logSpec, ForAppending, True)
If Err.Number = 0 Then
objLogFile.WriteLine message
objLogFile.Close
LogToCentralFile = True
Exit Function
End If
Randomize
Wscript.sleep 1000 + Rnd * 100
attempts = attempts + 1
Loop Until attempts >= 10
On Error Goto 0
End Function
'Name : PromptStart -> Prompt when script starts.
'Parameters : None ->
'Return : None ->
Function PromptStart
MsgBox "Now processing the " & DQ(Wscript.ScriptName) & " script.", vbInformation, scriptBaseName
End Function
'Name : PromptEnd -> Prompts when script has completed.
'Parameters : None ->
'Return : None ->
Function PromptEnd
MsgBox "The " & DQ(Wscript.ScriptName) & " script has completed successfully.", vbInformation, scriptBaseName
End Function
'Name : PromptError -> Prompts when an unexpected script error occurs.
'Parameters : None ->
'Return : None ->
'Function PromptEnd
' MsgBox "Error " & Err.Number & " (Hex " & Hex(Err.Number) & "). " & Err.Description, vbCritical, scriptBaseName
'End Function -
Hyper-V virtual network switch disconnects host machines network connection
When creating an external virtual switch for my Hyper-V machine, my hosts connection is lost immediately when applying the setting and is restored immediately after deleting the virtual switch.
Am I doing something wrong? It seemed pretty straightforward and I've followed steps that others have outlined to create the virtual switch.When I checked, "Allow management operating systems to share this network adapter", and checked "Enable virtual LAN identification for management operating systems" another SNAFU happened. I found in network connections, Ethernet properties,
my "Internet protocol version 4 unchecked, and Hyper-V Extensible virtual switch checked, and I no longer had network access. Again I had to remove my hyper-v external switch in hyper-v manager. I guess I could try using my WIFI as the switch,
but getting hyper-v Windows Server 2012 R2 has been a real problem.
I did the following steps:
To install and configure a virtual machine, complete the following steps:
1. Start Hyper-V Manager by clicking Start, Administrative Tools, Hyper-V Manager.
2. In Hyper-V Manager, right-click the server node in the left pane, point to New, and then select Virtual Machine. This starts the New Virtual Machine Wizard. Click Next.
3. In the Name text box, enter a name for the virtual machine, such as AppServer02.
4. By default, the virtual machine data is stored on the system disk. To select a different location, select the Store The Virtual Machine In A Different Location check box, click Browse,
and then use the Select Folder dialog box to select a save location. Click Next.
5. On the Assign Memory page, specify the amount of memory to allocate to the virtual machine. In most cases, you should reserve at least the minimum amount of memory recommended for the
operating system you plan to install. Click Next. 6.
On the Configure Networking page, use the Connection list to select a network adapter to use. Each new virtual machine includes a network adapter, and you can configure the adapter to use an available virtual network for communicating with other
computers. Click Next. 7.
On the Connect Virtual Hard Disk page, use the options provided to name and create a virtual hard disk for the virtual machine. Each virtual machine requires a virtual hard disk so that you can install an operating system and required applications.
Click Next. 8. On the Installation Options page, select Install An Operating System From A Boot CD/DVD-ROM. If you have physical distribution media, insert the distribution media, and then
specify the CD/DVD drive to use. If you want to install from an .iso image, select Image File, click Browse, and then use the Open dialog box to select the image file to use.
9. Click Next, and then click Finish.
10. In Hyper-V Manager, right-click the name of the virtual machine, and then click Connect.
11. In the Virtual Machine Connection window, click Start. After the virtual machine is initialized, the operating system installation should start automatically. Continue with the operating
system installation as you normally would.
It installed and booted, came up to a blue screen asking me to hit Ctrl-Alt-Del to logon, and when I did, it gave the selection to switch user, task manager, ect... didn't complete the install could not logon - did not have access to the internet to
logon with my Microsoft Account.
-
Attaching remote event receiver to a list on host web.
We have an O365 Sharepoint 2013 site. I am trying to create a remote event receiver and attach it to a list on host web instead of appweb. Below are the links that I am referencing to do it:
http://www.codeproject.com/Articles/636058/Adventures-with-SharePoint-2013-Remote-Event-Recei
http://blogs.msdn.com/b/knewton/archive/2012/12/11/defining-content-in-host-web-from-an-app-for-sharepoint.aspx
They are using 'AppInstalled' event to accomplish this. The method is as follows: get the client context of the host web, get our target list in the host web, get the service url of the remote event receiver using code below:
string remoteUrl = string.Format("https://{0}/OurRemoteEventReceiver.svc",
OperationContext.Current.Channel.LocalAddress.Uri.DnsSafeHost + "/services");
and then use it while adding an event receiver to our target list. A different way of obtaining this remoteUrl is shown in the second post.
When I try to do this I get the below error:
CorrelationId: eb837c4c-c434-4067-99f4-ad9b38e30d82
3> ErrorDetail: The remote event receiver callout failed.
3> ErrorType: Transient
3> ErrorTypeName: Intermittent
3> ExceptionMessage: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from
the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.
3> Source: Common
3> SourceName: Common App Deployment
Also, the 'Grant permissions to the App' window appears when I hit Deploy and immediately goes away before I hit or even see the 'Trust it' button. Then, after a while I get the above error in output window. This happens whenever I add the 'AppEventReceiver.svc'
by selecting 'AppInstalled' property to True and then write any code(or even not write any code) in it that targets the host web. Any suggestions please?Hi,
We can add the code snippet below in the "App Installed" event handler.
EventReceiverDefinitionCreationInformation eventReceiver = new EventReceiverDefinitionCreationInformation();
eventReceiver.EventType = EventReceiverType.ItemAdding;
eventReceiver.ReceiverAssembly = Assembly.GetExecutingAssembly().FullName;
eventReceiver.ReceiverClass = "OurRemoteEventReceiver";
eventReceiver.ReceiverName = "OurRemoteEventReceiver";
eventReceiver.ReceiverUrl = "http://xxx/OurRemoteEventReceiver.svc";
eventReceiver.SequenceNumber = 1000;
Web web = SPutil.getSP("http://sub.domain.com/sites/apps");
List targetList = web.Lists.GetByTitle("Host Web List");
targetList.EventReceivers.Add(eventReceiver);
web.Context.ExecuteQuery();
You will need to include an additional .NET class as well:
using System.Reflection;
If the problem still existed, I suggest to debug your remote event receiver project to find the cause of the error. The link below for your reference:
http://blogs.msdn.com/b/officeapps/archive/2013/01/03/debugging-remote-event-receivers-with-visual-studio.aspx
More information:
Add list item properties with a remote event receiver
http://code.msdn.microsoft.com/office/SharePoint-2013-Add-list-2c6e71e0
Best Regards,
Dennis Guo
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Get list of classes present in an applet's Jar file?
I have an applet for drawing diagrams, which is bundled in a jarfile together with classes for each type of element in the drawing (e.g. a class for drawing 2-input NAND gates, a class for J-K flip-flops, and so on). When I add a new type of drawing element I have to modify the applet to add the new class to the applet's "Insert" menu to allow the element to be inserted. What I want to do is to search the jarfile containing the applet for any classes derived from DrawingElement and add them automatically to the Insert menu when the applet is inited. I presume this would require using getClass().getClassLoader() to get the class loader that read the JAR file, but from there it would seem I need to know the name of the resource to load. Is there a way of browsing the list of resources in the JAR file?
AndrewThompson64 wrote:
That 'modify the applet' is not strictly necessary. The list of menu items and classes might be passed to the applet as applet parameters, or as a property file or XML (or whatever) that defines the available elements.I could do this -- I'm just trying to avoid getting the list out of step with the contents (or if you prefer, I'm just being lazy!).
Is there a way of browsing the list of resources in the JAR file?Yes and no. You might try this general strategy (untested).
1) Gain an URL to a resource in the Jar in which the plug-ins exist.
2) Parse that URL for everything before the '!' symbol to get an URL for the Jar itself.
3) Get an InputStream from the Jar via URL.openStream().
4) Get a ZipInputStream by wrapping the InputStream.
5) Iterate the ZipEntry(s) to identify classes in the correct package, and store them in a collection of some type.
6) Iterate the collection and check each one for extending DrawingElement, using reflection.
I am guessing step 6 will require the applet to be trusted.Sounds plausible, and I'll give it a whirl. However, I hadn't thought about the "trusted" bit of this; maybe I can just create new instances and cast to DrawingElement, ignoring any that throw exceptions. I'll have to give it a go and see what happens.
BTW - once you have the right classes, how do you get the screen name of them? Is the name defined in one of the attributes of a DrawingElement? What prevents name clashes?Plan A: I have a getIdentification() method that returns a string identifying the element, but I have to keep this unique the hard way (by hand).
Plan B: use the class name with some prettification (e.g. have a class _2_input_NAND_gate which gets displayed as "2 input NAND gate") so that the compiler does the work of keeping it unique. Not sure I like this, though.
Many thanks for your help.
Maybe you are looking for
-
Improved user experience transferring from APF to webDAV volume
We've all experienced how files that we drag from our Desktops and drop on folders on the same volume are "received" at their destination and "lost" at their origin. They move. Users in my organization desire a similar experience when dragging files
-
How Do I Pin A Tile To My New Tab Page, Instructions On Here Do Not Work.
These new FF updates are going to drive me to drink. It's a simple question, one would think, yet I cannot find the answer. FF29 has "tiles", I suppose they are called, when you click on "new tab page". At one point, I had them all on there...how, I
-
Is there an upgrade for using Photoshop CS 5 v12.1 x64 with Windows 8?
I recently upgraded to a new PC with Wndows 8. I installed PS CS5 and some annoying glitches have popped up. Have others had problems and is there a fix available?
-
Hi Gurus! I've leave quota called Earned leave, One Earned leave will be eligible for 20 days presence of employee at work. How we will address this in SAP. Can any body assist me in this reg Regards
-
I am trying to top up my credit but I keep getting...
I keep getting redirected to the Taiwan site when trying to buy credit. I am in the UAE and not in Taiwan. How do I buy credit without going through the Taiwan website which I cannot read. My account was set up in Australia.