Skip to main content

Posts

In Windows 7, how to create a route for a dial up PPTP VPN in powershell

# # VPN Route Fixer $VPNName = "VPN Name" $NetToRoute = "172.x.x.0/x" #----------------------------------------------------------- # Dial the VPN Connection rasdial $VPNName # Get the IP Address of the VPN Connection $vpnObj = Get-WmiObject -Namespace 'root/standardcimv2'        MSFT_NetIPaddress |        Where-Object { $_.InterfaceAlias -eq $VPNName } |        Select IPAddress $vpnIP = $vpnObj.IPAddress route add $NetToRoute mask 255.255.255.0 $vpnIP

Powershell not returning same memory use as Task Manager

Task Manager gets that information from a performance counter, which is not directly available from the information returned by Get-Process.  You can get to the information with PowerShell, though.  This example uses the Get-Counter cmdlet, which is new to PowerShell 4.0 (though you can use the underlying .NET classes to accomplish something similar in older versions of PowerShell, if needed.) Get-Process |  ForEach-Object {  $proc = $_  $counter = Get-Counter -Counter "\Process($($proc.Name))\Working Set - Private"  $pws = 'Unknown'  if ($null -ne $counter)  {    $pws = $counter.CounterSamples[0].CookedValue  }  $proc | Add-Member -NotePropertyName 'PrivateWorkingSetSize' -NotePropertyValue $pws -PassThru  } | Format-Table ProcessName,Id,PrivateWorkingSetSize This method is not fast. From: https://social.technet.microsoft.com/Forums/windowsserver/en-US/46665ab7-0a22-41b5-968c-b3942e9b4a4c/getpro...

Fixing up OneDrive Personal on Windows 8.1 after forensit profile migration

I migrated my profile to a domain profile using the forensit migration tool My onedrive location sits on another drive, this may explain why it didn't work, maybe, maybe not. Using Windows 8.1 Pro After the migration, I could no longer use Personal OneDrive.  The trick is the SID pointer to the OneDrive location.   This is held in the registry at  [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager\SkyDrive\UserSyncRoots] The "Name" will be your SID, the data will be where your local copy of one drive resides.  To get your SID, fire up powershell and enter the following.  You are looking for your domain account.  Make note of your SID. Get-WmiObject win32_useraccount | select Caption , SID Once you have your SID, stick that in the right location at   [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager\SkyDrive\UserSyncRoots]